2023-03-07 11:37:25

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 00/14] sfc: add vDPA support for EF100 devices

Hi All,

This series adds the vdpa support for EF100 devices.
For now, only a network class of vdpa device is supported and
they can be created only on a VF. Each EF100 VF can have one
of the three function personalities (EF100, vDPA & None) at
any time with EF100 being the default. A VF's function personality
is changed to vDPA while creating the vdpa device using vdpa tool.

A vDPA management device is created per VF to allow selection of
the desired VF for vDPA device creation. The MAC address for the
target net device must be set either by specifying at the vdpa
device creation time via the `mac` parameter of the `vdpa dev add`
command or should be specified as the hardware address of the virtual
function using `devlink port function set hw_addr` command before
creating the vdpa device with the former taking precedence.

Changes since v1:

- To ensure isolation between DMA initiated by userspace (guest OS)
and the host MCDI buffer, ummap VF's MCDI DMA buffer and use PF's
IOMMU domain instead for executing vDPA VF's MCDI commands.
- As a result of above change, it is no more necessary to check for
MCDI buffer's IOVA range overlap with the guest buffers. Accordingly,
the DMA config operations and the rbtree/list implementation to store
IOVA mappings have been dropped.
- Support vDPA only if running Firmware supports CLIENT_CMD_VF_PROXY
capability.
- Added .suspend config operation and updated get_vq_state/set_vq_state
to support Live Migration. Also, features VIRTIO_F_ORDER_PLATFORM and
VIRTIO_F_IN_ORDER have been masked off in get_device_features() to
allow Live Migration as QEMU SVQ doesn't support them yet.
- Removed the minimum version (v6.1.0) requirement of QEMU as
VIRTIO_F_IN_ORDER is not exposed
- Fetch the vdpa device MAC address from the underlying VF hw_addr (if
set via `devlink port function set hw_addr` command)
- Removed the mandatory requirement of specifying mac address while
creating vdpa device
- Moved create_vring_ctx() and get_doorbell_offset() in dev_add()
- Moved IRQ allocation at the time of vring creation
- Merged vring_created member of struct ef100_vdpa_vring_info as one
of the flags in vring_state
- Simplified .set_status() implementation
- Removed un-necessary vdpa_state checks against
EF100_VDPA_STATE_INITIALIZED
- Removed userspace triggerable warning in kick_vq()
- Updated year 2023 in copyright banner of new files

Gautam Dawar (14):
sfc: add function personality support for EF100 devices
sfc: implement MCDI interface for vDPA operations
sfc: update MCDI headers for CLIENT_CMD_VF_PROXY capability bit
sfc: evaluate vdpa support based on FW capability CLIENT_CMD_VF_PROXY
sfc: implement init and fini functions for vDPA personality
sfc: implement vDPA management device operations
sfc: implement vdpa device config operations
sfc: implement vdpa vring config operations
sfc: implement device status related vdpa config operations
sfc: implement filters for receiving traffic
sfc: use PF's IOMMU domain for running VF's MCDI commands
sfc: unmap VF's MCDI buffer when switching to vDPA mode
sfc: update vdpa device MAC address
sfc: register the vDPA device

drivers/net/ethernet/sfc/Kconfig | 8 +
drivers/net/ethernet/sfc/Makefile | 1 +
drivers/net/ethernet/sfc/ef10.c | 2 +-
drivers/net/ethernet/sfc/ef100.c | 7 +-
drivers/net/ethernet/sfc/ef100_netdev.c | 26 +-
drivers/net/ethernet/sfc/ef100_nic.c | 183 +-
drivers/net/ethernet/sfc/ef100_nic.h | 26 +-
drivers/net/ethernet/sfc/ef100_vdpa.c | 543 +++
drivers/net/ethernet/sfc/ef100_vdpa.h | 224 ++
drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 793 ++++
drivers/net/ethernet/sfc/mcdi.c | 108 +-
drivers/net/ethernet/sfc/mcdi.h | 9 +-
drivers/net/ethernet/sfc/mcdi_filters.c | 51 +-
drivers/net/ethernet/sfc/mcdi_functions.c | 9 +-
drivers/net/ethernet/sfc/mcdi_functions.h | 3 +-
drivers/net/ethernet/sfc/mcdi_pcol.h | 4390 ++++++++++++++++++++-
drivers/net/ethernet/sfc/mcdi_vdpa.c | 259 ++
drivers/net/ethernet/sfc/mcdi_vdpa.h | 83 +
drivers/net/ethernet/sfc/net_driver.h | 21 +
drivers/net/ethernet/sfc/ptp.c | 4 +-
20 files changed, 6574 insertions(+), 176 deletions(-)
create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa.c
create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa.h
create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa_ops.c
create mode 100644 drivers/net/ethernet/sfc/mcdi_vdpa.c
create mode 100644 drivers/net/ethernet/sfc/mcdi_vdpa.h

--
2.30.1



2023-03-07 11:37:29

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 01/14] sfc: add function personality support for EF100 devices

A function personality defines the location and semantics of
registers in the BAR. EF100 NICs allow different personalities
of a PCIe function and changing it at run-time. A total of three
function personalities are defined as of now: EF100, vDPA and
None with EF100 being the default.
For now, vDPA net devices can be created on a EF100 virtual
function and the VF personality will be changed to vDPA in the
process.

Co-developed-by: Martin Habets <[email protected]>
Signed-off-by: Martin Habets <[email protected]>
Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/ef100.c | 6 +-
drivers/net/ethernet/sfc/ef100_nic.c | 98 +++++++++++++++++++++++++++-
drivers/net/ethernet/sfc/ef100_nic.h | 11 ++++
3 files changed, 111 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
index 71aab3d0480f..c1c69783db7b 100644
--- a/drivers/net/ethernet/sfc/ef100.c
+++ b/drivers/net/ethernet/sfc/ef100.c
@@ -429,8 +429,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
if (!efx)
return;

- probe_data = container_of(efx, struct efx_probe_data, efx);
- ef100_remove_netdev(probe_data);
+ efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_NONE);
#ifdef CONFIG_SFC_SRIOV
efx_fini_struct_tc(efx);
#endif
@@ -443,6 +442,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
pci_disable_pcie_error_reporting(pci_dev);

pci_set_drvdata(pci_dev, NULL);
+ probe_data = container_of(efx, struct efx_probe_data, efx);
efx_fini_struct(efx);
kfree(probe_data);
};
@@ -508,7 +508,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
goto fail;

efx->state = STATE_PROBED;
- rc = ef100_probe_netdev(probe_data);
+ rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
if (rc)
goto fail;

diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
index 4dc643b0d2db..8cbe5e0f4bdf 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.c
+++ b/drivers/net/ethernet/sfc/ef100_nic.c
@@ -772,6 +772,99 @@ static int efx_ef100_get_base_mport(struct efx_nic *efx)
return 0;
}

+/* BAR configuration.
+ * To change BAR configuration, tear down the current configuration (which
+ * leaves the hardware in the PROBED state), and then initialise the new
+ * BAR state.
+ */
+struct ef100_bar_config_ops {
+ int (*init)(struct efx_probe_data *probe_data);
+ void (*fini)(struct efx_probe_data *probe_data);
+};
+
+static const struct ef100_bar_config_ops bar_config_ops[] = {
+ [EF100_BAR_CONFIG_EF100] = {
+ .init = ef100_probe_netdev,
+ .fini = ef100_remove_netdev
+ },
+#ifdef CONFIG_SFC_VDPA
+ [EF100_BAR_CONFIG_VDPA] = {
+ .init = NULL,
+ .fini = NULL
+ },
+#endif
+ [EF100_BAR_CONFIG_NONE] = {
+ .init = NULL,
+ .fini = NULL
+ },
+};
+
+/* Keep this in sync with the definition of enum ef100_bar_config. */
+static char *bar_config_name[] = {
+ [EF100_BAR_CONFIG_NONE] = "None",
+ [EF100_BAR_CONFIG_EF100] = "EF100",
+ [EF100_BAR_CONFIG_VDPA] = "vDPA",
+};
+
+#ifdef CONFIG_SFC_VDPA
+static bool efx_vdpa_supported(struct efx_nic *efx)
+{
+ return efx->type->is_vf;
+}
+#endif
+
+int efx_ef100_set_bar_config(struct efx_nic *efx,
+ enum ef100_bar_config new_config)
+{
+ const struct ef100_bar_config_ops *old_config_ops;
+ const struct ef100_bar_config_ops *new_config_ops;
+ struct ef100_nic_data *nic_data = efx->nic_data;
+ struct efx_probe_data *probe_data;
+ enum ef100_bar_config old_config;
+ int rc;
+
+ if (WARN_ON_ONCE(nic_data->bar_config > EF100_BAR_CONFIG_VDPA))
+ return -EINVAL;
+
+#ifdef CONFIG_SFC_VDPA
+ /* Current EF100 hardware supports vDPA on VFs only */
+ if (new_config == EF100_BAR_CONFIG_VDPA && !efx_vdpa_supported(efx)) {
+ pci_err(efx->pci_dev, "vdpa over PF not supported : %s",
+ efx->name);
+ return -EOPNOTSUPP;
+ }
+#endif
+ mutex_lock(&nic_data->bar_config_lock);
+ old_config = nic_data->bar_config;
+ if (new_config == old_config) {
+ mutex_unlock(&nic_data->bar_config_lock);
+ return 0;
+ }
+
+ old_config_ops = &bar_config_ops[old_config];
+ new_config_ops = &bar_config_ops[new_config];
+
+ probe_data = container_of(efx, struct efx_probe_data, efx);
+ if (old_config_ops->fini)
+ old_config_ops->fini(probe_data);
+ nic_data->bar_config = EF100_BAR_CONFIG_NONE;
+
+ if (new_config_ops->init) {
+ rc = new_config_ops->init(probe_data);
+ if (rc) {
+ mutex_unlock(&nic_data->bar_config_lock);
+ return rc;
+ }
+ }
+
+ nic_data->bar_config = new_config;
+ pci_dbg(efx->pci_dev, "BAR configuration changed to %s\n",
+ bar_config_name[new_config]);
+ mutex_unlock(&nic_data->bar_config_lock);
+
+ return 0;
+}
+
static int compare_versions(const char *a, const char *b)
{
int a_major, a_minor, a_point, a_patch;
@@ -1025,6 +1118,7 @@ static int ef100_probe_main(struct efx_nic *efx)
return -ENOMEM;
efx->nic_data = nic_data;
nic_data->efx = efx;
+ mutex_init(&nic_data->bar_config_lock);
efx->max_vis = EF100_MAX_VIS;

/* Populate design-parameter defaults */
@@ -1208,8 +1302,10 @@ void ef100_remove(struct efx_nic *efx)

efx_mcdi_detach(efx);
efx_mcdi_fini(efx);
- if (nic_data)
+ if (nic_data) {
efx_nic_free_buffer(efx, &nic_data->mcdi_buf);
+ mutex_destroy(&nic_data->bar_config_lock);
+ }
kfree(nic_data);
efx->nic_data = NULL;
}
diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h
index f1ed481c1260..4562982f2965 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.h
+++ b/drivers/net/ethernet/sfc/ef100_nic.h
@@ -61,6 +61,13 @@ enum {
EF100_STAT_COUNT
};

+/* Keep this in sync with the contents of bar_config_name. */
+enum ef100_bar_config {
+ EF100_BAR_CONFIG_NONE,
+ EF100_BAR_CONFIG_EF100,
+ EF100_BAR_CONFIG_VDPA,
+};
+
struct ef100_nic_data {
struct efx_nic *efx;
struct efx_buffer mcdi_buf;
@@ -71,6 +78,8 @@ struct ef100_nic_data {
u16 warm_boot_count;
u8 port_id[ETH_ALEN];
DECLARE_BITMAP(evq_phases, EFX_MAX_CHANNELS);
+ enum ef100_bar_config bar_config;
+ struct mutex bar_config_lock; /* lock to control access to bar config */
u64 stats[EF100_STAT_COUNT];
u32 base_mport;
bool have_mport; /* base_mport was populated successfully */
@@ -95,4 +104,6 @@ int ef100_filter_table_probe(struct efx_nic *efx);
int ef100_get_mac_address(struct efx_nic *efx, u8 *mac_address,
int client_handle, bool empty_ok);
int efx_ef100_lookup_client_id(struct efx_nic *efx, efx_qword_t pciefn, u32 *id);
+int efx_ef100_set_bar_config(struct efx_nic *efx,
+ enum ef100_bar_config new_config);
#endif /* EFX_EF100_NIC_H */
--
2.30.1


2023-03-07 11:37:50

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 02/14] sfc: implement MCDI interface for vDPA operations

Implement functions to perform vDPA operations like creating and
removing virtqueues, getting doorbell register offset etc. using
the MCDI interface with FW.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/Kconfig | 8 +
drivers/net/ethernet/sfc/Makefile | 1 +
drivers/net/ethernet/sfc/ef100_vdpa.h | 32 +++
drivers/net/ethernet/sfc/mcdi.h | 4 +
drivers/net/ethernet/sfc/mcdi_vdpa.c | 267 ++++++++++++++++++++++++++
drivers/net/ethernet/sfc/mcdi_vdpa.h | 83 ++++++++
6 files changed, 395 insertions(+)
create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa.h
create mode 100644 drivers/net/ethernet/sfc/mcdi_vdpa.c
create mode 100644 drivers/net/ethernet/sfc/mcdi_vdpa.h

diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig
index 4af36ba8906b..0b5091e26cd1 100644
--- a/drivers/net/ethernet/sfc/Kconfig
+++ b/drivers/net/ethernet/sfc/Kconfig
@@ -64,6 +64,14 @@ config SFC_MCDI_LOGGING
Driver-Interface) commands and responses, allowing debugging of
driver/firmware interaction. The tracing is actually enabled by
a sysfs file 'mcdi_logging' under the PCI device.
+config SFC_VDPA
+ bool "Solarflare EF100-family VDPA support"
+ depends on SFC && VDPA && SFC_SRIOV
+ default y
+ help
+ This enables support for the virtio data path acceleration (vDPA).
+ vDPA device's datapath complies with the virtio specification,
+ but control path is vendor specific.

source "drivers/net/ethernet/sfc/falcon/Kconfig"
source "drivers/net/ethernet/sfc/siena/Kconfig"
diff --git a/drivers/net/ethernet/sfc/Makefile b/drivers/net/ethernet/sfc/Makefile
index 55b9c73cd8ef..fb94fe3a9dfc 100644
--- a/drivers/net/ethernet/sfc/Makefile
+++ b/drivers/net/ethernet/sfc/Makefile
@@ -12,6 +12,7 @@ sfc-$(CONFIG_SFC_MTD) += mtd.o
sfc-$(CONFIG_SFC_SRIOV) += sriov.o ef10_sriov.o ef100_sriov.o ef100_rep.o \
mae.o tc.o tc_bindings.o tc_counters.o

+sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o
obj-$(CONFIG_SFC) += sfc.o

obj-$(CONFIG_SFC_FALCON) += falcon/
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
new file mode 100644
index 000000000000..f6564448d0c7
--- /dev/null
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Driver for Xilinx network controllers and boards
+ * Copyright (C) 2020-2022, Xilinx, Inc.
+ * Copyright (C) 2022, Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation, incorporated herein by reference.
+ */
+
+#ifndef __EF100_VDPA_H__
+#define __EF100_VDPA_H__
+
+#include <linux/vdpa.h>
+#include <uapi/linux/virtio_net.h>
+#include "net_driver.h"
+#include "ef100_nic.h"
+
+#if defined(CONFIG_SFC_VDPA)
+
+enum ef100_vdpa_device_type {
+ EF100_VDPA_DEVICE_TYPE_NET,
+};
+
+enum ef100_vdpa_vq_type {
+ EF100_VDPA_VQ_TYPE_NET_RXQ,
+ EF100_VDPA_VQ_TYPE_NET_TXQ,
+ EF100_VDPA_VQ_NTYPES
+};
+
+#endif /* CONFIG_SFC_VDPA */
+#endif /* __EF100_VDPA_H__ */
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
index b139b76febff..dafab52aaef7 100644
--- a/drivers/net/ethernet/sfc/mcdi.h
+++ b/drivers/net/ethernet/sfc/mcdi.h
@@ -214,6 +214,10 @@ void efx_mcdi_sensor_event(struct efx_nic *efx, efx_qword_t *ev);
#define _MCDI_STRUCT_DWORD(_buf, _field) \
((_buf) + (_MCDI_CHECK_ALIGN(_field ## _OFST, 4) >> 2))

+#define MCDI_SET_BYTE(_buf, _field, _value) do { \
+ BUILD_BUG_ON(MC_CMD_ ## _field ## _LEN != 1); \
+ *(u8 *)MCDI_PTR(_buf, _field) = _value; \
+ } while (0)
#define MCDI_STRUCT_SET_BYTE(_buf, _field, _value) do { \
BUILD_BUG_ON(_field ## _LEN != 1); \
*(u8 *)MCDI_STRUCT_PTR(_buf, _field) = _value; \
diff --git a/drivers/net/ethernet/sfc/mcdi_vdpa.c b/drivers/net/ethernet/sfc/mcdi_vdpa.c
new file mode 100644
index 000000000000..b9668545ca01
--- /dev/null
+++ b/drivers/net/ethernet/sfc/mcdi_vdpa.c
@@ -0,0 +1,267 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Driver for AMD network controllers and boards
+ * Copyright (C) 2023, Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation, incorporated herein by reference.
+ */
+
+#include <linux/vdpa.h>
+#include "ef100_vdpa.h"
+#include "efx.h"
+#include "nic.h"
+#include "mcdi_vdpa.h"
+#include "mcdi_pcol.h"
+
+/* The value of target_vf in virtio MC commands like
+ * virtqueue create, delete and get doorbell offset should
+ * contain the VF index when the calling function is a PF
+ * and VF_NULL (0xFFFF) otherwise. As the vDPA driver invokes
+ * MC commands in context of the VF, it uses VF_NULL.
+ */
+#define MC_CMD_VIRTIO_TARGET_VF_NULL 0xFFFF
+
+struct efx_vring_ctx *efx_vdpa_vring_init(struct efx_nic *efx, u32 vi,
+ enum ef100_vdpa_vq_type vring_type)
+{
+ struct efx_vring_ctx *vring_ctx;
+ u32 queue_cmd;
+
+ vring_ctx = kzalloc(sizeof(*vring_ctx), GFP_KERNEL);
+ if (!vring_ctx)
+ return ERR_PTR(-ENOMEM);
+
+ switch (vring_type) {
+ case EF100_VDPA_VQ_TYPE_NET_RXQ:
+ queue_cmd = MC_CMD_VIRTIO_INIT_QUEUE_REQ_NET_RXQ;
+ break;
+ case EF100_VDPA_VQ_TYPE_NET_TXQ:
+ queue_cmd = MC_CMD_VIRTIO_INIT_QUEUE_REQ_NET_TXQ;
+ break;
+ default:
+ pci_err(efx->pci_dev,
+ "%s: Invalid Queue type %u\n", __func__, vring_type);
+ kfree(vring_ctx);
+ return ERR_PTR(-ENOMEM);
+ }
+
+ vring_ctx->efx = efx;
+ vring_ctx->vf_index = MC_CMD_VIRTIO_TARGET_VF_NULL;
+ vring_ctx->vi_index = vi;
+ vring_ctx->mcdi_vring_type = queue_cmd;
+ return vring_ctx;
+}
+
+void efx_vdpa_vring_fini(struct efx_vring_ctx *vring_ctx)
+{
+ kfree(vring_ctx);
+}
+
+int efx_vdpa_get_features(struct efx_nic *efx,
+ enum ef100_vdpa_device_type type,
+ u64 *features)
+{
+ MCDI_DECLARE_BUF(outbuf, MC_CMD_VIRTIO_GET_FEATURES_OUT_LEN);
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_VIRTIO_GET_FEATURES_IN_LEN);
+ u32 high_val, low_val;
+ ssize_t outlen;
+ u32 dev_type;
+ int rc;
+
+ if (!efx) {
+ pci_err(efx->pci_dev, "%s: Invalid NIC pointer\n", __func__);
+ return -EINVAL;
+ }
+ switch (type) {
+ case EF100_VDPA_DEVICE_TYPE_NET:
+ dev_type = MC_CMD_VIRTIO_GET_FEATURES_IN_NET;
+ break;
+ default:
+ pci_err(efx->pci_dev,
+ "%s: Device type %d not supported\n", __func__, type);
+ return -EINVAL;
+ }
+ MCDI_SET_DWORD(inbuf, VIRTIO_GET_FEATURES_IN_DEVICE_ID, dev_type);
+ rc = efx_mcdi_rpc(efx, MC_CMD_VIRTIO_GET_FEATURES, inbuf, sizeof(inbuf),
+ outbuf, sizeof(outbuf), &outlen);
+ if (rc)
+ return rc;
+ if (outlen < MC_CMD_VIRTIO_GET_FEATURES_OUT_LEN)
+ return -EIO;
+ low_val = MCDI_DWORD(outbuf, VIRTIO_GET_FEATURES_OUT_FEATURES_LO);
+ high_val = MCDI_DWORD(outbuf, VIRTIO_GET_FEATURES_OUT_FEATURES_HI);
+ *features = ((u64)high_val << 32) | low_val;
+ return 0;
+}
+
+int efx_vdpa_verify_features(struct efx_nic *efx,
+ enum ef100_vdpa_device_type type, u64 features)
+{
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_VIRTIO_TEST_FEATURES_IN_LEN);
+ u32 dev_type;
+ int rc;
+
+ BUILD_BUG_ON(MC_CMD_VIRTIO_TEST_FEATURES_OUT_LEN != 0);
+ switch (type) {
+ case EF100_VDPA_DEVICE_TYPE_NET:
+ dev_type = MC_CMD_VIRTIO_GET_FEATURES_IN_NET;
+ break;
+ default:
+ pci_err(efx->pci_dev,
+ "%s: Device type %d not supported\n", __func__, type);
+ return -EINVAL;
+ }
+ MCDI_SET_DWORD(inbuf, VIRTIO_TEST_FEATURES_IN_DEVICE_ID, dev_type);
+ MCDI_SET_DWORD(inbuf, VIRTIO_TEST_FEATURES_IN_FEATURES_LO, features);
+ MCDI_SET_DWORD(inbuf, VIRTIO_TEST_FEATURES_IN_FEATURES_HI,
+ features >> 32);
+ rc = efx_mcdi_rpc(efx, MC_CMD_VIRTIO_TEST_FEATURES, inbuf,
+ sizeof(inbuf), NULL, 0, NULL);
+ return rc;
+}
+
+int efx_vdpa_vring_create(struct efx_vring_ctx *vring_ctx,
+ struct efx_vring_cfg *vring_cfg,
+ struct efx_vring_dyn_cfg *vring_dyn_cfg)
+{
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_VIRTIO_INIT_QUEUE_REQ_LEN);
+ struct efx_nic *efx = vring_ctx->efx;
+ int rc;
+
+ BUILD_BUG_ON(MC_CMD_VIRTIO_INIT_QUEUE_RESP_LEN != 0);
+
+ MCDI_SET_BYTE(inbuf, VIRTIO_INIT_QUEUE_REQ_QUEUE_TYPE,
+ vring_ctx->mcdi_vring_type);
+ MCDI_SET_WORD(inbuf, VIRTIO_INIT_QUEUE_REQ_TARGET_VF,
+ vring_ctx->vf_index);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_INSTANCE,
+ vring_ctx->vi_index);
+
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_SIZE, vring_cfg->size);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_DESC_TBL_ADDR_LO,
+ vring_cfg->desc);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_DESC_TBL_ADDR_HI,
+ vring_cfg->desc >> 32);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_AVAIL_RING_ADDR_LO,
+ vring_cfg->avail);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_AVAIL_RING_ADDR_HI,
+ vring_cfg->avail >> 32);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_USED_RING_ADDR_LO,
+ vring_cfg->used);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_USED_RING_ADDR_HI,
+ vring_cfg->used >> 32);
+ MCDI_SET_WORD(inbuf, VIRTIO_INIT_QUEUE_REQ_MSIX_VECTOR,
+ vring_cfg->msix_vector);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_FEATURES_LO,
+ vring_cfg->features);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_FEATURES_HI,
+ vring_cfg->features >> 32);
+
+ if (vring_dyn_cfg) {
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_INITIAL_PIDX,
+ vring_dyn_cfg->avail_idx);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_INITIAL_CIDX,
+ vring_dyn_cfg->used_idx);
+ }
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_MPORT_SELECTOR,
+ MAE_MPORT_SELECTOR_ASSIGNED);
+
+ rc = efx_mcdi_rpc(efx, MC_CMD_VIRTIO_INIT_QUEUE, inbuf, sizeof(inbuf),
+ NULL, 0, NULL);
+ return rc;
+}
+
+int efx_vdpa_vring_destroy(struct efx_vring_ctx *vring_ctx,
+ struct efx_vring_dyn_cfg *vring_dyn_cfg)
+{
+ MCDI_DECLARE_BUF(outbuf, MC_CMD_VIRTIO_FINI_QUEUE_RESP_LEN);
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_VIRTIO_FINI_QUEUE_REQ_LEN);
+ struct efx_nic *efx = vring_ctx->efx;
+ ssize_t outlen;
+ int rc;
+
+ MCDI_SET_BYTE(inbuf, VIRTIO_FINI_QUEUE_REQ_QUEUE_TYPE,
+ vring_ctx->mcdi_vring_type);
+ MCDI_SET_WORD(inbuf, VIRTIO_INIT_QUEUE_REQ_TARGET_VF,
+ vring_ctx->vf_index);
+ MCDI_SET_DWORD(inbuf, VIRTIO_INIT_QUEUE_REQ_INSTANCE,
+ vring_ctx->vi_index);
+ rc = efx_mcdi_rpc(efx, MC_CMD_VIRTIO_FINI_QUEUE, inbuf, sizeof(inbuf),
+ outbuf, sizeof(outbuf), &outlen);
+
+ if (rc)
+ return rc;
+
+ if (outlen < MC_CMD_VIRTIO_FINI_QUEUE_RESP_LEN)
+ return -EIO;
+
+ if (vring_dyn_cfg) {
+ vring_dyn_cfg->avail_idx = MCDI_DWORD(outbuf,
+ VIRTIO_FINI_QUEUE_RESP_FINAL_PIDX);
+ vring_dyn_cfg->used_idx = MCDI_DWORD(outbuf,
+ VIRTIO_FINI_QUEUE_RESP_FINAL_CIDX);
+ }
+
+ return 0;
+}
+
+int efx_vdpa_get_doorbell_offset(struct efx_vring_ctx *vring_ctx,
+ u32 *offset)
+{
+ MCDI_DECLARE_BUF(outbuf, MC_CMD_VIRTIO_GET_NET_DOORBELL_OFFSET_RESP_LEN);
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_VIRTIO_GET_DOORBELL_OFFSET_REQ_LEN);
+ struct efx_nic *efx = vring_ctx->efx;
+ ssize_t outlen;
+ int rc;
+
+ if (vring_ctx->mcdi_vring_type != MC_CMD_VIRTIO_INIT_QUEUE_REQ_NET_RXQ &&
+ vring_ctx->mcdi_vring_type != MC_CMD_VIRTIO_INIT_QUEUE_REQ_NET_TXQ) {
+ pci_err(efx->pci_dev,
+ "%s: Invalid Queue type %u\n",
+ __func__, vring_ctx->mcdi_vring_type);
+ return -EINVAL;
+ }
+
+ MCDI_SET_BYTE(inbuf, VIRTIO_GET_DOORBELL_OFFSET_REQ_DEVICE_ID,
+ MC_CMD_VIRTIO_GET_FEATURES_IN_NET);
+ MCDI_SET_WORD(inbuf, VIRTIO_GET_DOORBELL_OFFSET_REQ_TARGET_VF,
+ vring_ctx->vf_index);
+ MCDI_SET_DWORD(inbuf, VIRTIO_GET_DOORBELL_OFFSET_REQ_INSTANCE,
+ vring_ctx->vi_index);
+
+ rc = efx_mcdi_rpc(efx, MC_CMD_VIRTIO_GET_DOORBELL_OFFSET, inbuf,
+ sizeof(inbuf), outbuf, sizeof(outbuf), &outlen);
+ if (rc)
+ return rc;
+
+ if (outlen < MC_CMD_VIRTIO_GET_NET_DOORBELL_OFFSET_RESP_LEN)
+ return -EIO;
+ if (vring_ctx->mcdi_vring_type == MC_CMD_VIRTIO_INIT_QUEUE_REQ_NET_RXQ)
+ *offset = MCDI_DWORD(outbuf,
+ VIRTIO_GET_NET_DOORBELL_OFFSET_RESP_RX_DBL_OFFSET);
+ else
+ *offset = MCDI_DWORD(outbuf,
+ VIRTIO_GET_NET_DOORBELL_OFFSET_RESP_TX_DBL_OFFSET);
+
+ return 0;
+}
+
+int efx_vdpa_get_mtu(struct efx_nic *efx, u16 *mtu)
+{
+ MCDI_DECLARE_BUF(outbuf, MC_CMD_SET_MAC_V2_OUT_LEN);
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_SET_MAC_EXT_IN_LEN);
+ ssize_t outlen;
+ int rc;
+
+ MCDI_SET_DWORD(inbuf, SET_MAC_EXT_IN_CONTROL, 0);
+ rc = efx_mcdi_rpc(efx, MC_CMD_SET_MAC, inbuf, sizeof(inbuf),
+ outbuf, sizeof(outbuf), &outlen);
+ if (rc)
+ return rc;
+ if (outlen < MC_CMD_SET_MAC_V2_OUT_LEN)
+ return -EIO;
+
+ *mtu = MCDI_DWORD(outbuf, SET_MAC_V2_OUT_MTU);
+ return 0;
+}
diff --git a/drivers/net/ethernet/sfc/mcdi_vdpa.h b/drivers/net/ethernet/sfc/mcdi_vdpa.h
new file mode 100644
index 000000000000..d2bb0152d9c3
--- /dev/null
+++ b/drivers/net/ethernet/sfc/mcdi_vdpa.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Driver for AMD network controllers and boards
+ * Copyright (C) 2023, Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation, incorporated herein by reference.
+ */
+
+#ifndef EFX_MCDI_VDPA_H
+#define EFX_MCDI_VDPA_H
+
+#if defined(CONFIG_SFC_VDPA)
+#include "mcdi.h"
+
+/**
+ * struct efx_vring_ctx: The vring context
+ *
+ * @efx: pointer of the VF's efx_nic object
+ * @vf_index: VF index of the vDPA VF
+ * @vi_index: vi index to be used for queue creation
+ * @mcdi_vring_type: corresponding MCDI vring type
+ */
+struct efx_vring_ctx {
+ struct efx_nic *efx;
+ u32 vf_index;
+ u32 vi_index;
+ u32 mcdi_vring_type;
+};
+
+/**
+ * struct efx_vring_cfg: Configuration for vring creation
+ *
+ * @desc: Descriptor area address of the vring
+ * @avail: Available area address of the vring
+ * @used: Device area address of the vring
+ * @size: Queue size, in entries. Must be a power of two
+ * @msix_vector: msix vector address for the queue
+ * @features: negotiated feature bits
+ */
+struct efx_vring_cfg {
+ u64 desc;
+ u64 avail;
+ u64 used;
+ u32 size;
+ u16 msix_vector;
+ u64 features;
+};
+
+/**
+ * struct efx_vring_dyn_cfg - dynamic vring configuration
+ *
+ * @avail_idx: last available index of the vring
+ * @used_idx: last used index of the vring
+ */
+struct efx_vring_dyn_cfg {
+ u32 avail_idx;
+ u32 used_idx;
+};
+
+int efx_vdpa_get_features(struct efx_nic *efx, enum ef100_vdpa_device_type type,
+ u64 *featuresp);
+
+int efx_vdpa_verify_features(struct efx_nic *efx,
+ enum ef100_vdpa_device_type type, u64 features);
+
+struct efx_vring_ctx *efx_vdpa_vring_init(struct efx_nic *efx, u32 vi,
+ enum ef100_vdpa_vq_type vring_type);
+
+void efx_vdpa_vring_fini(struct efx_vring_ctx *vring_ctx);
+
+int efx_vdpa_vring_create(struct efx_vring_ctx *vring_ctx,
+ struct efx_vring_cfg *vring_cfg,
+ struct efx_vring_dyn_cfg *vring_dyn_cfg);
+
+int efx_vdpa_vring_destroy(struct efx_vring_ctx *vring_ctx,
+ struct efx_vring_dyn_cfg *vring_dyn_cfg);
+
+int efx_vdpa_get_doorbell_offset(struct efx_vring_ctx *vring_ctx,
+ u32 *offsetp);
+int efx_vdpa_get_mtu(struct efx_nic *efx, u16 *mtu);
+#endif
+#endif
--
2.30.1


2023-03-07 11:38:52

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 03/14] sfc: update MCDI headers for CLIENT_CMD_VF_PROXY capability bit

vDPA requires the ability to proxy MCDI commands from a PF to a VF
there by using PF's IOMMU domain for executing vDPA VF's MCDI commands
ensuring isolation from the DMA domain used by guest buffers.
A new capability bit CLIENT_CMD_VF_PROXY has been added to Firmware,
which when exposed, suggests that Firmware supports MC_CMD_CLIENT_CMD
to VFs and hence supports vDPA requirement.
mcdi_pcol.h is a tool generated file and hence may not be free from
all checks and/or warnings when tested with checkpatch.pl script.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/mcdi_pcol.h | 4390 +++++++++++++++++++++++++-
drivers/net/ethernet/sfc/mcdi_vdpa.c | 10 +-
2 files changed, 4288 insertions(+), 112 deletions(-)

diff --git a/drivers/net/ethernet/sfc/mcdi_pcol.h b/drivers/net/ethernet/sfc/mcdi_pcol.h
index cd297e19cddc..bdb6a53b8be3 100644
--- a/drivers/net/ethernet/sfc/mcdi_pcol.h
+++ b/drivers/net/ethernet/sfc/mcdi_pcol.h
@@ -2,10 +2,9 @@
/****************************************************************************
* Driver for Solarflare network controllers and boards
* Copyright 2009-2018 Solarflare Communications Inc.
- * Copyright 2019-2020 Xilinx Inc.
+ * Copyright 2019-2022 Xilinx Inc.
*/

-
#ifndef MCDI_PCOL_H
#define MCDI_PCOL_H

@@ -72,19 +71,19 @@
* | \------- Error
* \------------------------------ Resync (always set)
*
- * The client writes it's request into MC shared memory, and rings the
- * doorbell. Each request is completed by either by the MC writing
+ * The client writes its request into MC shared memory, and rings the
+ * doorbell. Each request is completed either by the MC writing
* back into shared memory, or by writing out an event.
*
* All MCDI commands support completion by shared memory response. Each
* request may also contain additional data (accounted for by HEADER.LEN),
- * and some response's may also contain additional data (again, accounted
+ * and some responses may also contain additional data (again, accounted
* for by HEADER.LEN).
*
* Some MCDI commands support completion by event, in which any associated
* response data is included in the event.
*
- * The protocol requires one response to be delivered for every request, a
+ * The protocol requires one response to be delivered for every request; a
* request should not be sent unless the response for the previous request
* has been received (either by polling shared memory, or by receiving
* an event).
@@ -121,7 +120,6 @@

#define MCDI_CTL_SDU_LEN_MAX MCDI_CTL_SDU_LEN_MAX_V2

-
/* The MC can generate events for two reasons:
* - To advance a shared memory request if XFLAGS_EVREQ was set
* - As a notification (link state, i2c event), controlled
@@ -165,6 +163,7 @@
#define FSE_AZ_EV_CODE_MCDI_EVRESPONSE 0xc


+
#define MC_CMD_ERR_CODE_OFST 0
#define MC_CMD_ERR_PROXY_PENDING_HANDLE_OFST 4

@@ -228,7 +227,6 @@
*/
#define EVB_STACK_ID(n) (((n) & 0xff) << 16)

-
/* Version 2 adds an optional argument to error returns: the errno value
* may be followed by the (0-based) number of the first argument that
* could not be processed.
@@ -321,7 +319,7 @@
/* enum: The requesting client is not a function */
#define MC_CMD_ERR_CLIENT_NOT_FN 0x100c
/* enum: The requested operation might require the command to be passed between
- * MCs, and thetransport doesn't support that. Should only ever been seen over
+ * MCs, and the transport doesn't support that. Should only ever been seen over
* the UART.
*/
#define MC_CMD_ERR_TRANSPORT_NOPROXY 0x100d
@@ -358,7 +356,7 @@
* sub-variant switching.
*/
#define MC_CMD_ERR_FILTERS_PRESENT 0x1014
-/* enum: The clock whose frequency you've attempted to set set doesn't exist on
+/* enum: The clock whose frequency you've attempted to set doesn't exist on
* this NIC
*/
#define MC_CMD_ERR_NO_CLOCK 0x1015
@@ -640,7 +638,11 @@
* be allocated by different counter blocks, so e.g. AR counter 42 is different
* from CT counter 42. Generation counts are also type-specific. This value is
* also present in the header of streaming counter packets, in the IDENTIFIER
- * field (see packetiser packet format definitions).
+ * field (see packetiser packet format definitions). Also note that LACP
+ * counter IDs are not allocated individually, instead the counter IDs are
+ * directly tied to the LACP balance table indices. These in turn are allocated
+ * in large contiguous blocks as a LAG config. Calling MAE_COUNTER_ALLOC/FREE
+ * with an LACP counter type will return EPERM.
*/
/* enum: Action Rule counters - can be referenced in AR response. */
#define MAE_COUNTER_TYPE_AR 0x0
@@ -648,6 +650,14 @@
#define MAE_COUNTER_TYPE_CT 0x1
/* enum: Outer Rule counters - can be referenced in OR response. */
#define MAE_COUNTER_TYPE_OR 0x2
+/* enum: LACP counters - linked to LACP balance table entries. */
+#define MAE_COUNTER_TYPE_LACP 0x3
+
+/* MAE_COUNTER_ID enum: ID of allocated counter or counter list. */
+/* enum: A counter ID that is guaranteed never to represent a real counter or
+ * counter list.
+ */
+#define MAE_COUNTER_ID_NULL 0xffffffff

/* TABLE_ID enum: Unique IDs for tables. The 32-bit ID values have been
* structured with bits [31:24] reserved (0), [23:16] indicating which major
@@ -656,7 +666,9 @@
* variations of the same table. (All of the tables currently defined within
* the streaming engines are listed here, but this does not imply that they are
* all supported - MC_CMD_TABLE_LIST returns the list of actually supported
- * tables.)
+ * tables.) The DPU offload engines' enumerators follow a deliberate pattern:
+ * 0x01010000 + is_dpu_net * 0x10000 + is_wr_or_tx * 0x8000 + is_lite_pipe *
+ * 0x1000 + oe_engine_type * 0x100 + oe_instance_within_pipe * 0x10
*/
/* enum: Outer_Rule_Table in the MAE - refer to SF-123102-TC. */
#define TABLE_ID_OUTER_RULE_TABLE 0x10000
@@ -694,6 +706,70 @@
#define TABLE_ID_RSS_CONTEXT_TABLE 0x20200
/* enum: Indirection_Table in VNIC Rx - refer to SF-123102-TC. */
#define TABLE_ID_INDIRECTION_TABLE 0x20300
+/* enum: DPU.host read pipe first CRC offload engine profiles - refer to
+ * XN-200147-AN.
+ */
+#define TABLE_ID_DPU_HOST_RD_CRC0_OE_PROFILE 0x1010000
+/* enum: DPU.host read pipe second CRC offload engine profiles - refer to
+ * XN-200147-AN.
+ */
+#define TABLE_ID_DPU_HOST_RD_CRC1_OE_PROFILE 0x1010010
+/* enum: DPU.host write pipe first CRC offload engine profiles - refer to
+ * XN-200147-AN.
+ */
+#define TABLE_ID_DPU_HOST_WR_CRC0_OE_PROFILE 0x1018000
+/* enum: DPU.host write pipe second CRC offload engine profiles - refer to
+ * XN-200147-AN.
+ */
+#define TABLE_ID_DPU_HOST_WR_CRC1_OE_PROFILE 0x1018010
+/* enum: DPU.net 'full' receive pipe CRC offload engine profiles - refer to
+ * XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_RX_CRC0_OE_PROFILE 0x1020000
+/* enum: DPU.net 'full' receive pipe first checksum offload engine profiles -
+ * refer to XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_RX_CSUM0_OE_PROFILE 0x1020100
+/* enum: DPU.net 'full' receive pipe second checksum offload engine profiles -
+ * refer to XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_RX_CSUM1_OE_PROFILE 0x1020110
+/* enum: DPU.net 'full' receive pipe AES-GCM offload engine profiles - refer to
+ * XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_RX_AES_GCM0_OE_PROFILE 0x1020200
+/* enum: DPU.net 'lite' receive pipe CRC offload engine profiles - refer to
+ * XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_RXLITE_CRC0_OE_PROFILE 0x1021000
+/* enum: DPU.net 'lite' receive pipe checksum offload engine profiles - refer
+ * to XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_RXLITE_CSUM0_OE_PROFILE 0x1021100
+/* enum: DPU.net 'full' transmit pipe CRC offload engine profiles - refer to
+ * XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_TX_CRC0_OE_PROFILE 0x1028000
+/* enum: DPU.net 'full' transmit pipe first checksum offload engine profiles -
+ * refer to XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_TX_CSUM0_OE_PROFILE 0x1028100
+/* enum: DPU.net 'full' transmit pipe second checksum offload engine profiles -
+ * refer to XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_TX_CSUM1_OE_PROFILE 0x1028110
+/* enum: DPU.net 'full' transmit pipe AES-GCM offload engine profiles - refer
+ * to XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_TX_AES_GCM0_OE_PROFILE 0x1028200
+/* enum: DPU.net 'lite' transmit pipe CRC offload engine profiles - refer to
+ * XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_TXLITE_CRC0_OE_PROFILE 0x1029000
+/* enum: DPU.net 'lite' transmit pipe checksum offload engine profiles - refer
+ * to XN-200147-AN.
+ */
+#define TABLE_ID_DPU_NET_TXLITE_CSUM0_OE_PROFILE 0x1029100

/* TABLE_COMPRESSED_VLAN enum: Compressed VLAN TPID as used by some field
* types; can be calculated by (((ether_type_msb >> 2) & 0x4) ^ 0x4) |
@@ -734,6 +810,42 @@
/* enum: RSS uses even spreading calculation. */
#define TABLE_RSS_SPREAD_MODE_EVEN 0x1

+/* CRC_VARIANT enum: Operation for the DPU CRC engine to perform. */
+/* enum: Calculate a 32-bit CRC. */
+#define CRC_VARIANT_CRC32 0x1
+/* enum: Calculate a 64-bit CRC. */
+#define CRC_VARIANT_CRC64 0x2
+
+/* DPU_CSUM_OP enum: Operation for the DPU checksum engine to perform. */
+/* enum: Calculate the checksum for a TCP payload, output result on OPR bus. */
+#define DPU_CSUM_OP_CALC_TCP 0x0
+/* enum: Calculate the checksum for a UDP payload, output result on OPR bus. */
+#define DPU_CSUM_OP_CALC_UDP 0x1
+/* enum: Calculate the checksum for a TCP payload, output match/not match value
+ * on OPR bus.
+ */
+#define DPU_CSUM_OP_VALIDATE_TCP 0x2
+/* enum: Calculate the checksum for a UDP payload, output match/not match value
+ * on OPR bus.
+ */
+#define DPU_CSUM_OP_VALIDATE_UDP 0x3
+
+/* GCM_OP_CODE enum: Operation for the DPU AES-GCM engine to perform. */
+/* enum: Encrypt/decrypt a stream of data. */
+#define GCM_OP_CODE_BULK_CRYPT 0x0
+/* enum: Calculate the authentication tag for a stream of data. */
+#define GCM_OP_CODE_BULK_AUTH 0x1
+/* enum: Encrypt/decrypt an IPsec packet. */
+#define GCM_OP_CODE_IPSEC_CRYPT 0x2
+/* enum: Calculate the authentication tag of an IPsec packet. */
+#define GCM_OP_CODE_IPSEC_AUTH 0x3
+
+/* AES_KEY_LEN enum: Key size for AES crypto operations */
+/* enum: 128 bit key size. */
+#define AES_KEY_LEN_AES_KEY_128 0x0
+/* enum: 256 bit key size. */
+#define AES_KEY_LEN_AES_KEY_256 0x1
+
/* TABLE_FIELD_ID enum: Unique IDs for fields. Related concepts have been
* loosely grouped together into blocks with gaps for expansion, but the values
* are arbitrary. Field IDs are not specific to particular tables, and in some
@@ -1026,6 +1138,16 @@
#define TABLE_FIELD_ID_BAL_TBL_BASE_DIV64 0xde
/* enum: Length of balance table region: 0=>64, 1=>128, 2=>256. */
#define TABLE_FIELD_ID_BAL_TBL_LEN_ID 0xdf
+/* enum: LACP LAG ID (i.e. the low 3 bits of LACP LAG mport ID), indexing
+ * LACP_LAG_Config_Table. Refer to SF-123102-TC.
+ */
+#define TABLE_FIELD_ID_LACP_LAG_ID 0xe0
+/* enum: Address in LACP_Balance_Table. The balance table is partitioned
+ * between LAGs according to the settings in LACP_LAG_Config_Table and then
+ * indexed by the LACP hash, providing the mapping to destination mports. Refer
+ * to SF-123102-TC.
+ */
+#define TABLE_FIELD_ID_BAL_TBL_ADDR 0xe1
/* enum: UDP port to match for UDP-based encapsulations; required to be 0 for
* other encapsulation types.
*/
@@ -1082,6 +1204,58 @@
#define TABLE_FIELD_ID_INDIR_TBL_LEN_ID 0x105
/* enum: An offset to be applied to the base destination queue ID. */
#define TABLE_FIELD_ID_INDIR_OFFSET 0x106
+/* enum: DPU offload engine profile ID to address. */
+#define TABLE_FIELD_ID_OE_PROFILE 0x3e8
+/* enum: Width of the CRC to calculate - see CRC_VARIANT enum. */
+#define TABLE_FIELD_ID_CRC_VARIANT 0x3f2
+/* enum: If set, reflect the bits of each input byte, bit 7 is LSB, bit 0 is
+ * MSB. If clear, bit 7 is MSB, bit 0 is LSB.
+ */
+#define TABLE_FIELD_ID_CRC_REFIN 0x3f3
+/* enum: If set, reflect the bits of each output byte, bit 7 is LSB, bit 0 is
+ * MSB. If clear, bit 7 is MSB, bit 0 is LSB.
+ */
+#define TABLE_FIELD_ID_CRC_REFOUT 0x3f4
+/* enum: If set, invert every bit of the output value. */
+#define TABLE_FIELD_ID_CRC_INVOUT 0x3f5
+/* enum: The CRC polynomial to use for checksumming, in normal form. See
+ * https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Specification for a
+ * description of normal form.
+ */
+#define TABLE_FIELD_ID_CRC_POLY 0x3f6
+/* enum: Operation for the checksum engine to perform - see DPU_CSUM_OP enum.
+ */
+#define TABLE_FIELD_ID_CSUM_OP 0x410
+/* enum: Byte offset of checksum relative to region_start (for VALIDATE_*
+ * operations only).
+ */
+#define TABLE_FIELD_ID_CSUM_OFFSET 0x411
+/* enum: Indicates there is additional data on OPR bus that needs to be
+ * incorporated into the payload checksum.
+ */
+#define TABLE_FIELD_ID_CSUM_OPR_ADDITIONAL_DATA 0x412
+/* enum: Log2 data size of additional data on OPR bus. */
+#define TABLE_FIELD_ID_CSUM_OPR_DATA_SIZE_LOG2 0x413
+/* enum: 4 byte offset of where to find the additional data on the OPR bus. */
+#define TABLE_FIELD_ID_CSUM_OPR_4B_OFF 0x414
+/* enum: Operation type for the AES-GCM core - see GCM_OP_CODE enum. */
+#define TABLE_FIELD_ID_GCM_OP_CODE 0x41a
+/* enum: Key length - AES_KEY_LEN enum. */
+#define TABLE_FIELD_ID_GCM_KEY_LEN 0x41b
+/* enum: OPR 4 byte offset for ICV or GHASH output (only in BULK_* mode) or
+ * IPSEC descrypt output.
+ */
+#define TABLE_FIELD_ID_GCM_OPR_4B_OFFSET 0x41c
+/* enum: If OP_CODE is BULK_*, indicates Emit GHASH (Fragment mode). Else,
+ * indicates IPSEC-ESN mode.
+ */
+#define TABLE_FIELD_ID_GCM_EMIT_GHASH_ISESN 0x41d
+/* enum: Replay Protection Enable. */
+#define TABLE_FIELD_ID_GCM_REPLAY_PROTECT_EN 0x41e
+/* enum: IPSEC Encrypt ESP trailer NEXT_HEADER byte. */
+#define TABLE_FIELD_ID_GCM_NEXT_HDR 0x41f
+/* enum: Replay Window Size. */
+#define TABLE_FIELD_ID_GCM_REPLAY_WIN_SIZE 0x420

/* MCDI_EVENT structuredef: The structure of an MCDI_EVENT on Siena/EF10/EF100
* platforms
@@ -1237,7 +1411,7 @@
#define MCDI_EVENT_AOE_FPGA_LOAD_FAILED 0xe
/* enum: Notify that invalid flash type detected */
#define MCDI_EVENT_AOE_INVALID_FPGA_FLASH_TYPE 0xf
-/* enum: Notify that the attempt to run FPGA Controller firmware timedout */
+/* enum: Notify that the attempt to run FPGA Controller firmware timed out */
#define MCDI_EVENT_AOE_FC_RUN_TIMEDOUT 0x10
/* enum: Failure to probe one or more FPGA boot flash chips */
#define MCDI_EVENT_AOE_FPGA_BOOT_FLASH_INVALID 0x11
@@ -1255,7 +1429,7 @@
#define MCDI_EVENT_AOE_ERR_FC_ASSERT_INFO_WIDTH 8
/* enum: FC Assert happened, but the register information is not available */
#define MCDI_EVENT_AOE_ERR_FC_ASSERT_SEEN 0x0
-/* enum: The register information for FC Assert is ready for readinng by driver
+/* enum: The register information for FC Assert is ready for reading by driver
*/
#define MCDI_EVENT_AOE_ERR_FC_ASSERT_DATA_READY 0x1
#define MCDI_EVENT_AOE_ERR_CODE_FPGA_HEADER_VERIFY_FAILED_OFST 0
@@ -1364,6 +1538,12 @@
#define MCDI_EVENT_MODULECHANGE_SEQ_OFST 0
#define MCDI_EVENT_MODULECHANGE_SEQ_LBN 30
#define MCDI_EVENT_MODULECHANGE_SEQ_WIDTH 2
+#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_OFST 0
+#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_LBN 0
+#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_WIDTH 16
+#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_OFST 0
+#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_LBN 16
+#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_WIDTH 16
#define MCDI_EVENT_DATA_LBN 0
#define MCDI_EVENT_DATA_WIDTH 32
/* Alias for PTP_DATA. */
@@ -1500,6 +1680,12 @@
* change to the journal.
*/
#define MCDI_EVENT_CODE_MPORT_JOURNAL_CHANGE 0x27
+/* enum: Notification that a source queue is enabled and attached to its proxy
+ * sink queue. SRC field contains the handle of the affected descriptor proxy
+ * function. DATA field contains the relative source queue number and absolute
+ * VI ID.
+ */
+#define MCDI_EVENT_CODE_DESC_PROXY_FUNC_QUEUE_START 0x28
/* enum: Artificial event generated by host and posted via MC for test
* purposes.
*/
@@ -1977,7 +2163,7 @@
#define MC_CMD_COPYCODE 0x3
#undef MC_CMD_0x3_PRIVILEGE_CTG

-#define MC_CMD_0x3_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x3_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_COPYCODE_IN msgrequest */
#define MC_CMD_COPYCODE_IN_LEN 16
@@ -3943,11 +4129,15 @@
/***********************************/
/* MC_CMD_CSR_READ32
* Read 32bit words from the indirect memory map.
+ *
+ * Note - this command originally belonged to INSECURE category. But access is
+ * required to specific registers for customer diagnostics. The command handler
+ * has additional checks to reject insecure calls.
*/
#define MC_CMD_CSR_READ32 0xc
#undef MC_CMD_0xc_PRIVILEGE_CTG

-#define MC_CMD_0xc_PRIVILEGE_CTG SRIOV_CTG_INSECURE
+#define MC_CMD_0xc_PRIVILEGE_CTG SRIOV_CTG_ADMIN

/* MC_CMD_CSR_READ32_IN msgrequest */
#define MC_CMD_CSR_READ32_IN_LEN 12
@@ -4013,7 +4203,7 @@
#define MC_CMD_HP 0x54
#undef MC_CMD_0x54_PRIVILEGE_CTG

-#define MC_CMD_0x54_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x54_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_HP_IN msgrequest */
#define MC_CMD_HP_IN_LEN 16
@@ -4931,6 +5121,53 @@
/* MC_CMD_GET_PHY_CFG_IN msgrequest */
#define MC_CMD_GET_PHY_CFG_IN_LEN 0

+/* MC_CMD_GET_PHY_CFG_IN_V2 msgrequest */
+#define MC_CMD_GET_PHY_CFG_IN_V2_LEN 8
+/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
+ * identifies a real or virtual network port by MAE port and link end. See the
+ * structure definition for more details
+ */
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_OFST 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LEN 8
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_OFST 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_LEN 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_LBN 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_WIDTH 32
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_OFST 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_LEN 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_LBN 32
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_WIDTH 32
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LINK_END_OFST 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LINK_END_LEN 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_OFST 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LEN 8
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_OFST 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_LEN 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_LBN 0
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_WIDTH 32
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_OFST 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_LEN 4
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_LBN 32
+#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_WIDTH 32
+
/* MC_CMD_GET_PHY_CFG_OUT msgresponse */
#define MC_CMD_GET_PHY_CFG_OUT_LEN 72
/* flags */
@@ -5026,6 +5263,9 @@
#define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_OFST 8
#define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_LBN 21
#define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_WIDTH 1
+#define MC_CMD_PHY_CAP_200000FDX_OFST 8
+#define MC_CMD_PHY_CAP_200000FDX_LBN 22
+#define MC_CMD_PHY_CAP_200000FDX_WIDTH 1
/* ?? */
#define MC_CMD_GET_PHY_CFG_OUT_CHANNEL_OFST 12
#define MC_CMD_GET_PHY_CFG_OUT_CHANNEL_LEN 4
@@ -5084,7 +5324,7 @@
#define MC_CMD_START_BIST 0x25
#undef MC_CMD_0x25_PRIVILEGE_CTG

-#define MC_CMD_0x25_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x25_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_START_BIST_IN msgrequest */
#define MC_CMD_START_BIST_IN_LEN 4
@@ -5124,7 +5364,7 @@
#define MC_CMD_POLL_BIST 0x26
#undef MC_CMD_0x26_PRIVILEGE_CTG

-#define MC_CMD_0x26_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x26_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_POLL_BIST_IN msgrequest */
#define MC_CMD_POLL_BIST_IN_LEN 0
@@ -5320,6 +5560,53 @@
/* MC_CMD_GET_LOOPBACK_MODES_IN msgrequest */
#define MC_CMD_GET_LOOPBACK_MODES_IN_LEN 0

+/* MC_CMD_GET_LOOPBACK_MODES_IN_V2 msgrequest */
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_LEN 8
+/* Target port to request loopback modes for. Uses MAE_LINK_ENDPOINT_SELECTOR
+ * which identifies a real or virtual network port by MAE port and link end.
+ * See the structure definition for more details
+ */
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_OFST 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_OFST 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_LBN 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_OFST 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_LBN 32
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LINK_END_OFST 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LINK_END_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_OFST 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_OFST 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_LBN 0
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_OFST 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_LBN 32
+#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_WIDTH 32
+
/* MC_CMD_GET_LOOPBACK_MODES_OUT msgresponse */
#define MC_CMD_GET_LOOPBACK_MODES_OUT_LEN 40
/* Supported loopbacks. */
@@ -5649,6 +5936,204 @@
/* Enum values, see field(s): */
/* 100M */

+/* MC_CMD_GET_LOOPBACK_MODES_OUT_V3 msgresponse: Supported loopback modes for
+ * newer NICs with 200G support
+ */
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_LEN 72
+/* Supported loopbacks. */
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_OFST 0
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_OFST 0
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_LBN 0
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_OFST 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_LBN 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_WIDTH 32
+/* enum: None. */
+/* MC_CMD_LOOPBACK_NONE 0x0 */
+/* enum: Data. */
+/* MC_CMD_LOOPBACK_DATA 0x1 */
+/* enum: GMAC. */
+/* MC_CMD_LOOPBACK_GMAC 0x2 */
+/* enum: XGMII. */
+/* MC_CMD_LOOPBACK_XGMII 0x3 */
+/* enum: XGXS. */
+/* MC_CMD_LOOPBACK_XGXS 0x4 */
+/* enum: XAUI. */
+/* MC_CMD_LOOPBACK_XAUI 0x5 */
+/* enum: GMII. */
+/* MC_CMD_LOOPBACK_GMII 0x6 */
+/* enum: SGMII. */
+/* MC_CMD_LOOPBACK_SGMII 0x7 */
+/* enum: XGBR. */
+/* MC_CMD_LOOPBACK_XGBR 0x8 */
+/* enum: XFI. */
+/* MC_CMD_LOOPBACK_XFI 0x9 */
+/* enum: XAUI Far. */
+/* MC_CMD_LOOPBACK_XAUI_FAR 0xa */
+/* enum: GMII Far. */
+/* MC_CMD_LOOPBACK_GMII_FAR 0xb */
+/* enum: SGMII Far. */
+/* MC_CMD_LOOPBACK_SGMII_FAR 0xc */
+/* enum: XFI Far. */
+/* MC_CMD_LOOPBACK_XFI_FAR 0xd */
+/* enum: GPhy. */
+/* MC_CMD_LOOPBACK_GPHY 0xe */
+/* enum: PhyXS. */
+/* MC_CMD_LOOPBACK_PHYXS 0xf */
+/* enum: PCS. */
+/* MC_CMD_LOOPBACK_PCS 0x10 */
+/* enum: PMA-PMD. */
+/* MC_CMD_LOOPBACK_PMAPMD 0x11 */
+/* enum: Cross-Port. */
+/* MC_CMD_LOOPBACK_XPORT 0x12 */
+/* enum: XGMII-Wireside. */
+/* MC_CMD_LOOPBACK_XGMII_WS 0x13 */
+/* enum: XAUI Wireside. */
+/* MC_CMD_LOOPBACK_XAUI_WS 0x14 */
+/* enum: XAUI Wireside Far. */
+/* MC_CMD_LOOPBACK_XAUI_WS_FAR 0x15 */
+/* enum: XAUI Wireside near. */
+/* MC_CMD_LOOPBACK_XAUI_WS_NEAR 0x16 */
+/* enum: GMII Wireside. */
+/* MC_CMD_LOOPBACK_GMII_WS 0x17 */
+/* enum: XFI Wireside. */
+/* MC_CMD_LOOPBACK_XFI_WS 0x18 */
+/* enum: XFI Wireside Far. */
+/* MC_CMD_LOOPBACK_XFI_WS_FAR 0x19 */
+/* enum: PhyXS Wireside. */
+/* MC_CMD_LOOPBACK_PHYXS_WS 0x1a */
+/* enum: PMA lanes MAC-Serdes. */
+/* MC_CMD_LOOPBACK_PMA_INT 0x1b */
+/* enum: KR Serdes Parallel (Encoder). */
+/* MC_CMD_LOOPBACK_SD_NEAR 0x1c */
+/* enum: KR Serdes Serial. */
+/* MC_CMD_LOOPBACK_SD_FAR 0x1d */
+/* enum: PMA lanes MAC-Serdes Wireside. */
+/* MC_CMD_LOOPBACK_PMA_INT_WS 0x1e */
+/* enum: KR Serdes Parallel Wireside (Full PCS). */
+/* MC_CMD_LOOPBACK_SD_FEP2_WS 0x1f */
+/* enum: KR Serdes Parallel Wireside (Sym Aligner to TX). */
+/* MC_CMD_LOOPBACK_SD_FEP1_5_WS 0x20 */
+/* enum: KR Serdes Parallel Wireside (Deserializer to Serializer). */
+/* MC_CMD_LOOPBACK_SD_FEP_WS 0x21 */
+/* enum: KR Serdes Serial Wireside. */
+/* MC_CMD_LOOPBACK_SD_FES_WS 0x22 */
+/* enum: Near side of AOE Siena side port */
+/* MC_CMD_LOOPBACK_AOE_INT_NEAR 0x23 */
+/* enum: Medford Wireside datapath loopback */
+/* MC_CMD_LOOPBACK_DATA_WS 0x24 */
+/* enum: Force link up without setting up any physical loopback (snapper use
+ * only)
+ */
+/* MC_CMD_LOOPBACK_FORCE_EXT_LINK 0x25 */
+/* Supported loopbacks. */
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_OFST 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_OFST 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_LBN 64
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_OFST 12
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_LBN 96
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_WIDTH 32
+/* Enum values, see field(s): */
+/* 100M */
+/* Supported loopbacks. */
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_OFST 16
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_OFST 16
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_LBN 128
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_OFST 20
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_LBN 160
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_WIDTH 32
+/* Enum values, see field(s): */
+/* 100M */
+/* Supported loopbacks. */
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_OFST 24
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_OFST 24
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_LBN 192
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_OFST 28
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_LBN 224
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_WIDTH 32
+/* Enum values, see field(s): */
+/* 100M */
+/* Supported loopbacks. */
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_OFST 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_OFST 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_LBN 256
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_OFST 36
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_LBN 288
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_WIDTH 32
+/* Enum values, see field(s): */
+/* 100M */
+/* Supported 25G loopbacks. */
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_OFST 40
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_OFST 40
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_LBN 320
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_OFST 44
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_LBN 352
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_WIDTH 32
+/* Enum values, see field(s): */
+/* 100M */
+/* Supported 50 loopbacks. */
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_OFST 48
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_OFST 48
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_LBN 384
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_OFST 52
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_LBN 416
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_WIDTH 32
+/* Enum values, see field(s): */
+/* 100M */
+/* Supported 100G loopbacks. */
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_OFST 56
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_OFST 56
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_LBN 448
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_OFST 60
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_LBN 480
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_WIDTH 32
+/* Enum values, see field(s): */
+/* 100M */
+/* Supported 200G loopbacks. */
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_OFST 64
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LEN 8
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_OFST 64
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_LBN 512
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_WIDTH 32
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_OFST 68
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_LEN 4
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_LBN 544
+#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_WIDTH 32
+/* Enum values, see field(s): */
+/* 100M */
+
/* AN_TYPE structuredef: Auto-negotiation types defined in IEEE802.3 */
#define AN_TYPE_LEN 4
#define AN_TYPE_TYPE_OFST 0
@@ -5694,6 +6179,53 @@
/* MC_CMD_GET_LINK_IN msgrequest */
#define MC_CMD_GET_LINK_IN_LEN 0

+/* MC_CMD_GET_LINK_IN_V2 msgrequest */
+#define MC_CMD_GET_LINK_IN_V2_LEN 8
+/* Target port to request link state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
+ * identifies a real or virtual network port by MAE port and link end. See the
+ * structure definition for more details.
+ */
+#define MC_CMD_GET_LINK_IN_V2_TARGET_OFST 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_LEN 8
+#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_OFST 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_LEN 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_LBN 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_WIDTH 32
+#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_OFST 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_LEN 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_LBN 32
+#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_WIDTH 32
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
+#define MC_CMD_GET_LINK_IN_V2_TARGET_LINK_END_OFST 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_LINK_END_LEN 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_OFST 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LEN 8
+#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_OFST 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_LEN 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_LBN 0
+#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_WIDTH 32
+#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_OFST 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_LEN 4
+#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_LBN 32
+#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_WIDTH 32
+
/* MC_CMD_GET_LINK_OUT msgresponse */
#define MC_CMD_GET_LINK_OUT_LEN 28
/* Near-side advertised capabilities. Refer to
@@ -5969,6 +6501,94 @@
#define MC_CMD_SET_LINK_IN_V2_MODULE_SEQ_IGNORE_LBN 7
#define MC_CMD_SET_LINK_IN_V2_MODULE_SEQ_IGNORE_WIDTH 1

+/* MC_CMD_SET_LINK_IN_V3 msgrequest */
+#define MC_CMD_SET_LINK_IN_V3_LEN 28
+/* Near-side advertised capabilities. Refer to
+ * MC_CMD_GET_PHY_CFG_OUT/SUPPORTED_CAP for bit definitions.
+ */
+#define MC_CMD_SET_LINK_IN_V3_CAP_OFST 0
+#define MC_CMD_SET_LINK_IN_V3_CAP_LEN 4
+/* Flags */
+#define MC_CMD_SET_LINK_IN_V3_FLAGS_OFST 4
+#define MC_CMD_SET_LINK_IN_V3_FLAGS_LEN 4
+#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_OFST 4
+#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_LBN 0
+#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_WIDTH 1
+#define MC_CMD_SET_LINK_IN_V3_POWEROFF_OFST 4
+#define MC_CMD_SET_LINK_IN_V3_POWEROFF_LBN 1
+#define MC_CMD_SET_LINK_IN_V3_POWEROFF_WIDTH 1
+#define MC_CMD_SET_LINK_IN_V3_TXDIS_OFST 4
+#define MC_CMD_SET_LINK_IN_V3_TXDIS_LBN 2
+#define MC_CMD_SET_LINK_IN_V3_TXDIS_WIDTH 1
+#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_OFST 4
+#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_LBN 3
+#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_WIDTH 1
+/* Loopback mode. */
+#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_MODE_OFST 8
+#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_MODE_LEN 4
+/* Enum values, see field(s): */
+/* MC_CMD_GET_LOOPBACK_MODES/MC_CMD_GET_LOOPBACK_MODES_OUT/100M */
+/* A loopback speed of "0" is supported, and means (choose any available
+ * speed).
+ */
+#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_SPEED_OFST 12
+#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_SPEED_LEN 4
+#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_OFST 16
+#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_LEN 1
+#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_OFST 16
+#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_LBN 0
+#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_WIDTH 7
+#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_OFST 16
+#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_LBN 7
+#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_WIDTH 1
+/* Padding */
+#define MC_CMD_SET_LINK_IN_V3_RESERVED_OFST 17
+#define MC_CMD_SET_LINK_IN_V3_RESERVED_LEN 3
+/* Target port to set link state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
+ * identifies a real or virtual network port by MAE port and link end. See the
+ * structure definition for more details
+ */
+#define MC_CMD_SET_LINK_IN_V3_TARGET_OFST 20
+#define MC_CMD_SET_LINK_IN_V3_TARGET_LEN 8
+#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_OFST 20
+#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_LEN 4
+#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_LBN 160
+#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_WIDTH 32
+#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_OFST 24
+#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_LEN 4
+#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_LBN 192
+#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_WIDTH 32
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_OFST 20
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_LEN 4
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FLAT_OFST 20
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FLAT_LEN 4
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_TYPE_OFST 23
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_TYPE_LEN 1
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 20
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 160
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 180
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 176
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 22
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 20
+#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
+#define MC_CMD_SET_LINK_IN_V3_TARGET_LINK_END_OFST 24
+#define MC_CMD_SET_LINK_IN_V3_TARGET_LINK_END_LEN 4
+#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_OFST 20
+#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LEN 8
+#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_OFST 20
+#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_LEN 4
+#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_LBN 160
+#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_WIDTH 32
+#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_OFST 24
+#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_LEN 4
+#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_LBN 192
+#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_WIDTH 32
+
/* MC_CMD_SET_LINK_OUT msgresponse */
#define MC_CMD_SET_LINK_OUT_LEN 0

@@ -6188,19 +6808,9 @@
#define MC_CMD_SET_MAC_V3_IN_CFG_FCS_OFST 28
#define MC_CMD_SET_MAC_V3_IN_CFG_FCS_LBN 4
#define MC_CMD_SET_MAC_V3_IN_CFG_FCS_WIDTH 1
-/* Identifies the MAC to update by the specifying the end of a logical MAE
- * link. Setting TARGET to MAE_LINK_ENDPOINT_COMPAT is equivalent to using the
- * previous version of the command (MC_CMD_SET_MAC_EXT). Not all possible
- * combinations of MPORT_END and MPORT_SELECTOR in TARGET will work in all
- * circumstances. 1. Some will always work (e.g. a VF can always address its
- * logical MAC using MPORT_SELECTOR=ASSIGNED,LINK_END=VNIC), 2. Some are not
- * meaningful and will always fail with EINVAL (e.g. attempting to address the
- * VNIC end of a link to a physical port), 3. Some are meaningful but require
- * the MCDI client to have the required permission and fail with EPERM
- * otherwise (e.g. trying to set the MAC on a VF the caller cannot administer),
- * and 4. Some could be implementation-specific and fail with ENOTSUP if not
- * available (no examples exist right now). See SF-123581-TC section 4.3 for
- * more details.
+/* Target port to set mac state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
+ * identifies a real or virtual network port by MAE port and link end. See the
+ * structure definition for more details
*/
#define MC_CMD_SET_MAC_V3_IN_TARGET_OFST 32
#define MC_CMD_SET_MAC_V3_IN_TARGET_LEN 8
@@ -6405,6 +7015,97 @@
#define MC_CMD_MAC_STATS_IN_PORT_ID_OFST 16
#define MC_CMD_MAC_STATS_IN_PORT_ID_LEN 4

+/* MC_CMD_MAC_STATS_V2_IN msgrequest */
+#define MC_CMD_MAC_STATS_V2_IN_LEN 28
+/* ??? */
+#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_OFST 0
+#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LEN 8
+#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_OFST 0
+#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_LEN 4
+#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_LBN 0
+#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_WIDTH 32
+#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_OFST 4
+#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_LEN 4
+#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_LBN 32
+#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_WIDTH 32
+#define MC_CMD_MAC_STATS_V2_IN_CMD_OFST 8
+#define MC_CMD_MAC_STATS_V2_IN_CMD_LEN 4
+#define MC_CMD_MAC_STATS_V2_IN_DMA_OFST 8
+#define MC_CMD_MAC_STATS_V2_IN_DMA_LBN 0
+#define MC_CMD_MAC_STATS_V2_IN_DMA_WIDTH 1
+#define MC_CMD_MAC_STATS_V2_IN_CLEAR_OFST 8
+#define MC_CMD_MAC_STATS_V2_IN_CLEAR_LBN 1
+#define MC_CMD_MAC_STATS_V2_IN_CLEAR_WIDTH 1
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_OFST 8
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_LBN 2
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_WIDTH 1
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_OFST 8
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_LBN 3
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_WIDTH 1
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_OFST 8
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_LBN 4
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_WIDTH 1
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_OFST 8
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_LBN 5
+#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_WIDTH 1
+#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_OFST 8
+#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_LBN 16
+#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_WIDTH 16
+/* DMA length. Should be set to MAC_STATS_NUM_STATS * sizeof(uint64_t), as
+ * returned by MC_CMD_GET_CAPABILITIES_V4_OUT. For legacy firmware not
+ * supporting MC_CMD_GET_CAPABILITIES_V4_OUT, DMA_LEN should be set to
+ * MC_CMD_MAC_NSTATS * sizeof(uint64_t)
+ */
+#define MC_CMD_MAC_STATS_V2_IN_DMA_LEN_OFST 12
+#define MC_CMD_MAC_STATS_V2_IN_DMA_LEN_LEN 4
+/* port id so vadapter stats can be provided */
+#define MC_CMD_MAC_STATS_V2_IN_PORT_ID_OFST 16
+#define MC_CMD_MAC_STATS_V2_IN_PORT_ID_LEN 4
+/* Target port to request statistics for. Uses MAE_LINK_ENDPOINT_SELECTOR which
+ * identifies a real or virtual network port by MAE port and link end. See the
+ * structure definition for more details
+ */
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_OFST 20
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_LEN 8
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_OFST 20
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_LEN 4
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_LBN 160
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_WIDTH 32
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_OFST 24
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_LEN 4
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_LBN 192
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_WIDTH 32
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_OFST 20
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_LEN 4
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FLAT_OFST 20
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FLAT_LEN 4
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_TYPE_OFST 23
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_TYPE_LEN 1
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 20
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 160
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 180
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 176
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 22
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 20
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_LINK_END_OFST 24
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_LINK_END_LEN 4
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_OFST 20
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LEN 8
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_OFST 20
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_LEN 4
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_LBN 160
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_WIDTH 32
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_OFST 24
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_LEN 4
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_LBN 192
+#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_WIDTH 32
+
/* MC_CMD_MAC_STATS_OUT_DMA msgresponse */
#define MC_CMD_MAC_STATS_OUT_DMA_LEN 0

@@ -7522,7 +8223,7 @@
#define MC_CMD_REBOOT 0x3d
#undef MC_CMD_0x3d_PRIVILEGE_CTG

-#define MC_CMD_0x3d_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x3d_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_REBOOT_IN msgrequest */
#define MC_CMD_REBOOT_IN_LEN 4
@@ -8061,6 +8762,53 @@
/* MC_CMD_GET_PHY_STATE_IN msgrequest */
#define MC_CMD_GET_PHY_STATE_IN_LEN 0

+/* MC_CMD_GET_PHY_STATE_IN_V2 msgrequest */
+#define MC_CMD_GET_PHY_STATE_IN_V2_LEN 8
+/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
+ * identifies a real or virtual network port by MAE port and link end. See the
+ * structure definition for more details.
+ */
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_OFST 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LEN 8
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_OFST 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_LEN 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_LBN 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_WIDTH 32
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_OFST 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_LEN 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_LBN 32
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_WIDTH 32
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LINK_END_OFST 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LINK_END_LEN 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_OFST 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LEN 8
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_OFST 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_LEN 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_LBN 0
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_WIDTH 32
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_OFST 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_LEN 4
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_LBN 32
+#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_WIDTH 32
+
/* MC_CMD_GET_PHY_STATE_OUT msgresponse */
#define MC_CMD_GET_PHY_STATE_OUT_LEN 4
#define MC_CMD_GET_PHY_STATE_OUT_STATE_OFST 0
@@ -8200,7 +8948,7 @@
#define MC_CMD_TESTASSERT 0x49
#undef MC_CMD_0x49_PRIVILEGE_CTG

-#define MC_CMD_0x49_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x49_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_TESTASSERT_IN msgrequest */
#define MC_CMD_TESTASSERT_IN_LEN 0
@@ -8324,6 +9072,61 @@
#define MC_CMD_GET_PHY_MEDIA_INFO_IN_DSFP_BANK_LBN 16
#define MC_CMD_GET_PHY_MEDIA_INFO_IN_DSFP_BANK_WIDTH 16

+/* MC_CMD_GET_PHY_MEDIA_INFO_IN_V2 msgrequest */
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_LEN 12
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_PAGE_OFST 0
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_PAGE_LEN 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_OFST 0
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_LBN 0
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_WIDTH 16
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_OFST 0
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_LBN 16
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_WIDTH 16
+/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
+ * identifies a real or virtual network port by MAE port and link end. See the
+ * structure definition for more details
+ */
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_OFST 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LEN 8
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_OFST 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_LEN 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_LBN 32
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_WIDTH 32
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_OFST 8
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_LEN 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_LBN 64
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_WIDTH 32
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_OFST 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 7
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 32
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 52
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 48
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 6
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LINK_END_OFST 8
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LINK_END_LEN 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_OFST 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LEN 8
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_OFST 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_LEN 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_LBN 32
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_WIDTH 32
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_OFST 8
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_LEN 4
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_LBN 64
+#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_WIDTH 32
+
/* MC_CMD_GET_PHY_MEDIA_INFO_OUT msgresponse */
#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMIN 5
#define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMAX 252
@@ -8348,7 +9151,7 @@
#define MC_CMD_NVRAM_TEST 0x4c
#undef MC_CMD_0x4c_PRIVILEGE_CTG

-#define MC_CMD_0x4c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x4c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_NVRAM_TEST_IN msgrequest */
#define MC_CMD_NVRAM_TEST_IN_LEN 4
@@ -8593,7 +9396,7 @@
#define MC_CMD_CLP 0x56
#undef MC_CMD_0x56_PRIVILEGE_CTG

-#define MC_CMD_0x56_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x56_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_CLP_IN msgrequest */
#define MC_CMD_CLP_IN_LEN 4
@@ -9500,27 +10303,22 @@
* and a generation count for this version of the sensor table. On systems
* advertising the DYNAMIC_SENSORS capability bit, this replaces the
* MC_CMD_READ_SENSORS command. On multi-MC systems this may include sensors
- * added by the NMC.
- *
- * Sensor handles are persistent for the lifetime of the sensor and are used to
- * identify sensors in MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS and
- * MC_CMD_DYNAMIC_SENSORS_GET_VALUES.
- *
- * The generation count is maintained by the MC, is persistent across reboots
- * and will be incremented each time the sensor table is modified. When the
- * table is modified, a CODE_DYNAMIC_SENSORS_CHANGE event will be generated
- * containing the new generation count. The driver should compare this against
- * the current generation count, and if it is different, call
- * MC_CMD_DYNAMIC_SENSORS_LIST again to update it's copy of the sensor table.
- *
- * The sensor count is provided to allow a future path to supporting more than
+ * added by the NMC. Sensor handles are persistent for the lifetime of the
+ * sensor and are used to identify sensors in
+ * MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS and
+ * MC_CMD_DYNAMIC_SENSORS_GET_VALUES. The generation count is maintained by the
+ * MC, is persistent across reboots and will be incremented each time the
+ * sensor table is modified. When the table is modified, a
+ * CODE_DYNAMIC_SENSORS_CHANGE event will be generated containing the new
+ * generation count. The driver should compare this against the current
+ * generation count, and if it is different, call MC_CMD_DYNAMIC_SENSORS_LIST
+ * again to update it's copy of the sensor table. The sensor count is provided
+ * to allow a future path to supporting more than
* MC_CMD_DYNAMIC_SENSORS_GET_READINGS_IN_HANDLES_MAXNUM_MCDI2 sensors, i.e.
* the maximum number that will fit in a single response. As this is a fairly
* large number (253) it is not anticipated that this will be needed in the
- * near future, so can currently be ignored.
- *
- * On Riverhead this command is implemented as a wrapper for `list` in the
- * sensor_query SPHINX service.
+ * near future, so can currently be ignored. On Riverhead this command is
+ * implemented as a wrapper for `list` in the sensor_query SPHINX service.
*/
#define MC_CMD_DYNAMIC_SENSORS_LIST 0x66
#undef MC_CMD_0x66_PRIVILEGE_CTG
@@ -9557,15 +10355,13 @@
/***********************************/
/* MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS
* Get descriptions for a set of sensors, specified as an array of sensor
- * handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST
- *
- * Any handles which do not correspond to a sensor currently managed by the MC
- * will be dropped from from the response. This may happen when a sensor table
- * update is in progress, and effectively means the set of usable sensors is
- * the intersection between the sets of sensors known to the driver and the MC.
- *
- * On Riverhead this command is implemented as a wrapper for
- * `get_descriptions` in the sensor_query SPHINX service.
+ * handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST. Any handles which do not
+ * correspond to a sensor currently managed by the MC will be dropped from from
+ * the response. This may happen when a sensor table update is in progress, and
+ * effectively means the set of usable sensors is the intersection between the
+ * sets of sensors known to the driver and the MC. On Riverhead this command is
+ * implemented as a wrapper for `get_descriptions` in the sensor_query SPHINX
+ * service.
*/
#define MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS 0x67
#undef MC_CMD_0x67_PRIVILEGE_CTG
@@ -9602,19 +10398,15 @@
/***********************************/
/* MC_CMD_DYNAMIC_SENSORS_GET_READINGS
* Read the state and value for a set of sensors, specified as an array of
- * sensor handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST.
- *
- * In the case of a broken sensor, then the state of the response's
- * MC_CMD_DYNAMIC_SENSORS_VALUE entry will be set to BROKEN, and any value
- * provided should be treated as erroneous.
- *
- * Any handles which do not correspond to a sensor currently managed by the MC
- * will be dropped from from the response. This may happen when a sensor table
- * update is in progress, and effectively means the set of usable sensors is
- * the intersection between the sets of sensors known to the driver and the MC.
- *
- * On Riverhead this command is implemented as a wrapper for `get_readings`
- * in the sensor_query SPHINX service.
+ * sensor handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST. In the case of a
+ * broken sensor, then the state of the response's MC_CMD_DYNAMIC_SENSORS_VALUE
+ * entry will be set to BROKEN, and any value provided should be treated as
+ * erroneous. Any handles which do not correspond to a sensor currently managed
+ * by the MC will be dropped from from the response. This may happen when a
+ * sensor table update is in progress, and effectively means the set of usable
+ * sensors is the intersection between the sets of sensors known to the driver
+ * and the MC. On Riverhead this command is implemented as a wrapper for
+ * `get_readings` in the sensor_query SPHINX service.
*/
#define MC_CMD_DYNAMIC_SENSORS_GET_READINGS 0x68
#undef MC_CMD_0x68_PRIVILEGE_CTG
@@ -10212,6 +11004,42 @@
#define CTPIO_STATS_MAP_BUCKET_LBN 16
#define CTPIO_STATS_MAP_BUCKET_WIDTH 16

+/* MESSAGE_TYPE structuredef: When present this defines the meaning of a
+ * message, and is used to protect against chosen message attacks in signed
+ * messages, regardless their origin. The message type also defines the
+ * signature cryptographic algorithm, encoding, and message fields included in
+ * the signature. The values are used in different commands but must be unique
+ * across all commands, e.g. MC_CMD_TSA_BIND_IN_SECURE_UNBIND uses different
+ * message type than MC_CMD_SECURE_NIC_INFO_IN_STATUS.
+ */
+#define MESSAGE_TYPE_LEN 4
+#define MESSAGE_TYPE_MESSAGE_TYPE_OFST 0
+#define MESSAGE_TYPE_MESSAGE_TYPE_LEN 4
+#define MESSAGE_TYPE_UNUSED 0x0 /* enum */
+/* enum: Message type value for the response to a
+ * MC_CMD_TSA_BIND_IN_SECURE_UNBIND message. TSA_SECURE_UNBIND messages are
+ * ECDSA SECP384R1 signed using SHA384 message digest algorithm over fields
+ * MESSAGE_TYPE, TSANID, TSAID, and UNBINDTOKEN, and encoded as suggested by
+ * RFC6979 (section 2.4).
+ */
+#define MESSAGE_TYPE_TSA_SECURE_UNBIND 0x1
+/* enum: Message type value for the response to a
+ * MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION message. TSA_SECURE_DECOMMISSION
+ * messages are ECDSA SECP384R1 signed using SHA384 message digest algorithm
+ * over fields MESSAGE_TYPE, TSAID, USER, and REASON, and encoded as suggested
+ * by RFC6979 (section 2.4).
+ */
+#define MESSAGE_TYPE_TSA_SECURE_DECOMMISSION 0x2
+/* enum: Message type value for the response to a
+ * MC_CMD_SECURE_NIC_INFO_IN_STATUS message. This enum value is not sequential
+ * to other message types for backwards compatibility as the message type for
+ * MC_CMD_SECURE_NIC_INFO_IN_STATUS was defined before the existence of this
+ * global enum.
+ */
+#define MESSAGE_TYPE_SECURE_NIC_INFO_STATUS 0xdb4
+#define MESSAGE_TYPE_MESSAGE_TYPE_LBN 0
+#define MESSAGE_TYPE_MESSAGE_TYPE_WIDTH 32
+

/***********************************/
/* MC_CMD_READ_REGS
@@ -12860,6 +13688,48 @@
#define MC_CMD_GET_PARSER_DISP_RESTRICTIONS_OUT_DST_IP_MCAST_ONLY_LBN 0
#define MC_CMD_GET_PARSER_DISP_RESTRICTIONS_OUT_DST_IP_MCAST_ONLY_WIDTH 1

+/* MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT msgresponse:
+ * GET_PARSER_DISP_INFO response format for OP_GET_SECURITY_RULE_INFO.
+ * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_LEN 36
+/* identifies the type of operation requested */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_OP_OFST 0
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_OP_LEN 4
+/* Enum values, see field(s): */
+/* MC_CMD_GET_PARSER_DISP_INFO_IN/OP */
+/* a version number representing the set of rule lookups that are implemented
+ * by the currently running firmware
+ */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_OFST 4
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_LEN 4
+/* enum: implements lookup sequences described in SF-114946-SW draft C */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_SF_114946_SW_C 0x0
+/* the number of nodes in the subnet map */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_NODES_OFST 8
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_NODES_LEN 4
+/* the number of entries in one subnet map node */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_ENTRIES_PER_NODE_OFST 12
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_ENTRIES_PER_NODE_LEN 4
+/* minimum valid value for a subnet ID in a subnet map leaf */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MIN_OFST 16
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MIN_LEN 4
+/* maximum valid value for a subnet ID in a subnet map leaf */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MAX_OFST 20
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MAX_LEN 4
+/* the number of entries in the local and remote port range maps */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_TREE_NUM_ENTRIES_OFST 24
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_TREE_NUM_ENTRIES_LEN 4
+/* minimum valid value for a portrange ID in a port range map leaf */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MIN_OFST 28
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MIN_LEN 4
+/* maximum valid value for a portrange ID in a port range map leaf */
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MAX_OFST 32
+#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MAX_LEN 4
+
/* MC_CMD_GET_PARSER_DISP_VNIC_ENCAP_MATCHES_OUT msgresponse: This response is
* returned if a MC_CMD_GET_PARSER_DISP_INFO_IN request is sent with OP value
* OP_GET_SUPPORTED_VNIC_ENCAP_MATCHES. It contains information about the
@@ -13716,7 +14586,7 @@
#define MC_CMD_SATELLITE_DOWNLOAD 0x91
#undef MC_CMD_0x91_PRIVILEGE_CTG

-#define MC_CMD_0x91_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x91_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_SATELLITE_DOWNLOAD_IN msgrequest: The reset requirements for the CPUs
* are subtle, and so downloads must proceed in a number of phases.
@@ -13835,10 +14705,9 @@

/***********************************/
/* MC_CMD_GET_CAPABILITIES
- * Get device capabilities.
- *
- * This is supplementary to the MC_CMD_GET_BOARD_CFG command, and intended to
- * reference inherent device capabilities as opposed to current NVRAM config.
+ * Get device capabilities. This is supplementary to the MC_CMD_GET_BOARD_CFG
+ * command, and intended to reference inherent device capabilities as opposed
+ * to current NVRAM config.
*/
#define MC_CMD_GET_CAPABILITIES 0xbe
#undef MC_CMD_0xbe_PRIVILEGE_CTG
@@ -16796,9 +17665,15 @@
#define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
#define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
#define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
+#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
+#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
#define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
#define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
#define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_OFST 148
+#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_LBN 15
+#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1

/* MC_CMD_GET_CAPABILITIES_V8_OUT msgresponse */
#define MC_CMD_GET_CAPABILITIES_V8_OUT_LEN 160
@@ -17300,9 +18175,15 @@
#define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
#define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
#define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
+#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
+#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
#define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
#define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
#define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_OFST 148
+#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_LBN 15
+#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
/* These bits are reserved for communicating test-specific capabilities to
* host-side test software. All production drivers should treat this field as
* opaque.
@@ -17818,9 +18699,15 @@
#define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
#define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
#define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
+#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
+#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
#define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
#define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
#define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_OFST 148
+#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_LBN 15
+#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
/* These bits are reserved for communicating test-specific capabilities to
* host-side test software. All production drivers should treat this field as
* opaque.
@@ -18371,9 +19258,15 @@
#define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
#define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
#define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
+#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
+#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
#define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
#define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
#define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
+#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_OFST 148
+#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_LBN 15
+#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
/* These bits are reserved for communicating test-specific capabilities to
* host-side test software. All production drivers should treat this field as
* opaque.
@@ -18468,6 +19361,13 @@
* are not defined.
*/
#define MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_TSA 0x1
+/* enum: MCDI command used for platform management. Typically, these commands
+ * are used for low-level operations directed at the platform as a whole (e.g.
+ * MMIO device enumeration) rather than individual functions and use a
+ * dedicated comms channel (e.g. RPmsg/IPI). May be handled by the same or
+ * different CPU as MCDI_MESSAGE_TYPE_MC.
+ */
+#define MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_PLATFORM 0x2


/***********************************/
@@ -20179,7 +21079,7 @@
#define MC_CMD_SHMBOOT_OP 0xe6
#undef MC_CMD_0xe6_PRIVILEGE_CTG

-#define MC_CMD_0xe6_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0xe6_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_SHMBOOT_OP_IN msgrequest */
#define MC_CMD_SHMBOOT_OP_IN_LEN 4
@@ -20448,7 +21348,7 @@
#define MC_CMD_ENABLE_OFFLINE_BIST 0xed
#undef MC_CMD_0xed_PRIVILEGE_CTG

-#define MC_CMD_0xed_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0xed_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_ENABLE_OFFLINE_BIST_IN msgrequest */
#define MC_CMD_ENABLE_OFFLINE_BIST_IN_LEN 0
@@ -20588,7 +21488,7 @@
#define MC_CMD_KR_TUNE 0xf1
#undef MC_CMD_0xf1_PRIVILEGE_CTG

-#define MC_CMD_0xf1_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0xf1_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_KR_TUNE_IN msgrequest */
#define MC_CMD_KR_TUNE_IN_LENMIN 4
@@ -21144,7 +22044,7 @@
#define MC_CMD_PCIE_TUNE 0xf2
#undef MC_CMD_0xf2_PRIVILEGE_CTG

-#define MC_CMD_0xf2_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0xf2_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_PCIE_TUNE_IN msgrequest */
#define MC_CMD_PCIE_TUNE_IN_LENMIN 4
@@ -21877,7 +22777,7 @@
#define MC_CMD_LICENSING_V3_TEMPORARY 0xd6
#undef MC_CMD_0xd6_PRIVILEGE_CTG

-#define MC_CMD_0xd6_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0xd6_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_LICENSING_V3_TEMPORARY_IN msgrequest */
#define MC_CMD_LICENSING_V3_TEMPORARY_IN_LEN 4
@@ -22305,8 +23205,8 @@
* TLV_PORT_MODE_*). A superset of MC_CMD_GET_PORT_MODES_OUT/MODES that
* contains all modes implemented in firmware for a particular board. Modes
* listed in MODES are considered production modes and should be exposed in
- * userland tools. Modes listed in ENGINEERING_MODES, but not in MODES
- * should be considered hidden (not to be exposed in userland tools) and for
+ * userland tools. Modes listed in ENGINEERING_MODES, but not in MODES should
+ * be considered hidden (not to be exposed in userland tools) and for
* engineering use only. There are no other semantic differences and any mode
* listed in either MODES or ENGINEERING_MODES can be set on the board.
*/
@@ -22937,7 +23837,7 @@
#define MC_CMD_EXEC_SIGNED 0x10c
#undef MC_CMD_0x10c_PRIVILEGE_CTG

-#define MC_CMD_0x10c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x10c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_EXEC_SIGNED_IN msgrequest */
#define MC_CMD_EXEC_SIGNED_IN_LEN 28
@@ -22967,7 +23867,7 @@
#define MC_CMD_PREPARE_SIGNED 0x10d
#undef MC_CMD_0x10d_PRIVILEGE_CTG

-#define MC_CMD_0x10d_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x10d_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_PREPARE_SIGNED_IN msgrequest */
#define MC_CMD_PREPARE_SIGNED_IN_LEN 4
@@ -22979,6 +23879,445 @@
#define MC_CMD_PREPARE_SIGNED_OUT_LEN 0


+/***********************************/
+/* MC_CMD_SET_SECURITY_RULE
+ * Set blacklist and/or whitelist action for a particular match criteria.
+ * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_SET_SECURITY_RULE 0x10f
+#undef MC_CMD_0x10f_PRIVILEGE_CTG
+
+#define MC_CMD_0x10f_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_SET_SECURITY_RULE_IN msgrequest */
+#define MC_CMD_SET_SECURITY_RULE_IN_LEN 92
+/* fields to include in match criteria */
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_FIELDS_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_FIELDS_LEN 4
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_LBN 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_LBN 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_LBN 2
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_LBN 3
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_LBN 4
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_LBN 5
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_LBN 6
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_LBN 7
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_LBN 8
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_LBN 9
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_LBN 10
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_LBN 11
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_LBN 12
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_LBN 13
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_WIDTH 1
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_LBN 14
+#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_WIDTH 1
+/* remote MAC address to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_MAC_OFST 4
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_MAC_LEN 6
+/* remote port to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORT_OFST 10
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORT_LEN 2
+/* local MAC address to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_MAC_OFST 12
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_MAC_LEN 6
+/* local port to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORT_OFST 18
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORT_LEN 2
+/* Ethernet type to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_ETHER_TYPE_OFST 20
+#define MC_CMD_SET_SECURITY_RULE_IN_ETHER_TYPE_LEN 2
+/* Inner VLAN tag to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_INNER_VLAN_OFST 22
+#define MC_CMD_SET_SECURITY_RULE_IN_INNER_VLAN_LEN 2
+/* Outer VLAN tag to match (as bytes in network order) */
+#define MC_CMD_SET_SECURITY_RULE_IN_OUTER_VLAN_OFST 24
+#define MC_CMD_SET_SECURITY_RULE_IN_OUTER_VLAN_LEN 2
+/* IP protocol to match (in low byte; set high byte to 0) */
+#define MC_CMD_SET_SECURITY_RULE_IN_IP_PROTO_OFST 26
+#define MC_CMD_SET_SECURITY_RULE_IN_IP_PROTO_LEN 2
+/* Physical port to match (as little-endian 32-bit value) */
+#define MC_CMD_SET_SECURITY_RULE_IN_PHYSICAL_PORT_OFST 28
+#define MC_CMD_SET_SECURITY_RULE_IN_PHYSICAL_PORT_LEN 4
+/* Reserved; set to 0 */
+#define MC_CMD_SET_SECURITY_RULE_IN_RESERVED_OFST 32
+#define MC_CMD_SET_SECURITY_RULE_IN_RESERVED_LEN 4
+/* remote IP address to match (as bytes in network order; set last 12 bytes to
+ * 0 for IPv4 address)
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_IP_OFST 36
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_IP_LEN 16
+/* local IP address to match (as bytes in network order; set last 12 bytes to 0
+ * for IPv4 address)
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_IP_OFST 52
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_IP_LEN 16
+/* remote subnet ID to match (as little-endian 32-bit value); note that remote
+ * subnets are matched by mapping the remote IP address to a "subnet ID" via a
+ * data structure which must already have been configured using
+ * MC_CMD_SUBNET_MAP_SET_NODE appropriately
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_SUBNET_ID_OFST 68
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_SUBNET_ID_LEN 4
+/* remote portrange ID to match (as little-endian 32-bit value); note that
+ * remote port ranges are matched by mapping the remote port to a "portrange
+ * ID" via a data structure which must already have been configured using
+ * MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORTRANGE_ID_OFST 72
+#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORTRANGE_ID_LEN 4
+/* local portrange ID to match (as little-endian 32-bit value); note that local
+ * port ranges are matched by mapping the local port to a "portrange ID" via a
+ * data structure which must already have been configured using
+ * MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORTRANGE_ID_OFST 76
+#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORTRANGE_ID_LEN 4
+/* set the action for transmitted packets matching this rule */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_OFST 80
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_LEN 4
+/* enum: make no decision */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_NONE 0x0
+/* enum: decide to accept the packet */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_WHITELIST 0x1
+/* enum: decide to drop the packet */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_BLACKLIST 0x2
+/* enum: inform the TSA controller about some sample of packets matching this
+ * rule (via MC_CMD_TSA_INFO_IN_PKT_SAMPLE messages); may be bitwise-ORed with
+ * either the WHITELIST or BLACKLIST action
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_SAMPLE 0x4
+/* enum: do not change the current TX action */
+#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_UNCHANGED 0xffffffff
+/* set the action for received packets matching this rule */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_OFST 84
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_LEN 4
+/* enum: make no decision */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_NONE 0x0
+/* enum: decide to accept the packet */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_WHITELIST 0x1
+/* enum: decide to drop the packet */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_BLACKLIST 0x2
+/* enum: inform the TSA controller about some sample of packets matching this
+ * rule (via MC_CMD_TSA_INFO_IN_PKT_SAMPLE messages); may be bitwise-ORed with
+ * either the WHITELIST or BLACKLIST action
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_SAMPLE 0x4
+/* enum: do not change the current RX action */
+#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_UNCHANGED 0xffffffff
+/* counter ID to associate with this rule; IDs are allocated using
+ * MC_CMD_SECURITY_RULE_COUNTER_ALLOC
+ */
+#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_OFST 88
+#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_LEN 4
+/* enum: special value for the null counter ID */
+#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_NONE 0x0
+/* enum: special value to tell the MC to allocate an available counter */
+#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_SW_AUTO 0xeeeeeeee
+/* enum: special value to request use of hardware counter (Medford2 only) */
+#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_HW 0xffffffff
+
+/* MC_CMD_SET_SECURITY_RULE_OUT msgresponse */
+#define MC_CMD_SET_SECURITY_RULE_OUT_LEN 32
+/* new reference count for uses of counter ID */
+#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_REFCNT_OFST 0
+#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_REFCNT_LEN 4
+/* constructed match bits for this rule (as a tracing aid only) */
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_MATCH_BITS_OFST 4
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_MATCH_BITS_LEN 12
+/* constructed discriminator bits for this rule (as a tracing aid only) */
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_DISCRIMINATOR_OFST 16
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_DISCRIMINATOR_LEN 4
+/* base location for probes for this rule (as a tracing aid only) */
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_BASE_OFST 20
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_BASE_LEN 4
+/* step for probes for this rule (as a tracing aid only) */
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_STEP_OFST 24
+#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_STEP_LEN 4
+/* ID for reading back the counter */
+#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_ID_OFST 28
+#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_ID_LEN 4
+
+
+/***********************************/
+/* MC_CMD_RESET_SECURITY_RULES
+ * Reset all blacklist and whitelist actions for a particular physical port, or
+ * all ports. (Medford-only; for use by SolarSecure apps, not directly by
+ * drivers. See SF-114946-SW.) NOTE - this message definition is provisional.
+ * It has not yet been used in any released code and may change during
+ * development. This note will be removed once it is regarded as stable.
+ */
+#define MC_CMD_RESET_SECURITY_RULES 0x110
+#undef MC_CMD_0x110_PRIVILEGE_CTG
+
+#define MC_CMD_0x110_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_RESET_SECURITY_RULES_IN msgrequest */
+#define MC_CMD_RESET_SECURITY_RULES_IN_LEN 4
+/* index of physical port to reset (or ALL_PHYSICAL_PORTS to reset all) */
+#define MC_CMD_RESET_SECURITY_RULES_IN_PHYSICAL_PORT_OFST 0
+#define MC_CMD_RESET_SECURITY_RULES_IN_PHYSICAL_PORT_LEN 4
+/* enum: special value to reset all physical ports */
+#define MC_CMD_RESET_SECURITY_RULES_IN_ALL_PHYSICAL_PORTS 0xffffffff
+
+/* MC_CMD_RESET_SECURITY_RULES_OUT msgresponse */
+#define MC_CMD_RESET_SECURITY_RULES_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_GET_SECURITY_RULESET_VERSION
+ * Return a large hash value representing a "version" of the complete set of
+ * currently active blacklist / whitelist rules and associated data structures.
+ * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_GET_SECURITY_RULESET_VERSION 0x111
+#undef MC_CMD_0x111_PRIVILEGE_CTG
+
+#define MC_CMD_0x111_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_GET_SECURITY_RULESET_VERSION_IN msgrequest */
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_IN_LEN 0
+
+/* MC_CMD_GET_SECURITY_RULESET_VERSION_OUT msgresponse */
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMIN 1
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMAX 252
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMAX_MCDI2 1020
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LEN(num) (0+1*(num))
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_NUM(len) (((len)-0)/1)
+/* Opaque hash value; length may vary depending on the hash scheme used */
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_OFST 0
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_LEN 1
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MINNUM 1
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MAXNUM 252
+#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MAXNUM_MCDI2 1020
+
+
+/***********************************/
+/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC
+ * Allocate counters for use with blacklist / whitelist rules. (Medford-only;
+ * for use by SolarSecure apps, not directly by drivers. See SF-114946-SW.)
+ * NOTE - this message definition is provisional. It has not yet been used in
+ * any released code and may change during development. This note will be
+ * removed once it is regarded as stable.
+ */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC 0x112
+#undef MC_CMD_0x112_PRIVILEGE_CTG
+
+#define MC_CMD_0x112_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN msgrequest */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_LEN 4
+/* the number of new counter IDs to request */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_NUM_COUNTERS_OFST 0
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_NUM_COUNTERS_LEN 4
+
+/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT msgresponse */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMIN 4
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMAX 252
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMAX_MCDI2 1020
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LEN(num) (4+4*(num))
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_NUM(len) (((len)-4)/4)
+/* the number of new counter IDs allocated (may be less than the number
+ * requested if resources are unavailable)
+ */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_NUM_COUNTERS_OFST 0
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_NUM_COUNTERS_LEN 4
+/* new counter ID(s) */
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_OFST 4
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_LEN 4
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MINNUM 0
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM 62
+#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM_MCDI2 254
+
+
+/***********************************/
+/* MC_CMD_SECURITY_RULE_COUNTER_FREE
+ * Allocate counters for use with blacklist / whitelist rules. (Medford-only;
+ * for use by SolarSecure apps, not directly by drivers. See SF-114946-SW.)
+ * NOTE - this message definition is provisional. It has not yet been used in
+ * any released code and may change during development. This note will be
+ * removed once it is regarded as stable.
+ */
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE 0x113
+#undef MC_CMD_0x113_PRIVILEGE_CTG
+
+#define MC_CMD_0x113_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_SECURITY_RULE_COUNTER_FREE_IN msgrequest */
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMIN 4
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMAX 252
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMAX_MCDI2 1020
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LEN(num) (4+4*(num))
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_NUM(len) (((len)-4)/4)
+/* the number of counter IDs to free */
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_NUM_COUNTERS_OFST 0
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_NUM_COUNTERS_LEN 4
+/* the counter ID(s) to free */
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_OFST 4
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_LEN 4
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MINNUM 0
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MAXNUM 62
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MAXNUM_MCDI2 254
+
+/* MC_CMD_SECURITY_RULE_COUNTER_FREE_OUT msgresponse */
+#define MC_CMD_SECURITY_RULE_COUNTER_FREE_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_SUBNET_MAP_SET_NODE
+ * Atomically update a trie node in the map of subnets to subnet IDs. The
+ * constants in the descriptions of the fields of this message may be retrieved
+ * by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO. (Medford-
+ * only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_SUBNET_MAP_SET_NODE 0x114
+#undef MC_CMD_0x114_PRIVILEGE_CTG
+
+#define MC_CMD_0x114_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_SUBNET_MAP_SET_NODE_IN msgrequest */
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMIN 6
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMAX 252
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMAX_MCDI2 1020
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LEN(num) (4+2*(num))
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_NUM(len) (((len)-4)/2)
+/* node to update in the range 0 .. SUBNET_MAP_NUM_NODES-1 */
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_NODE_ID_OFST 0
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_NODE_ID_LEN 4
+/* SUBNET_MAP_NUM_ENTRIES_PER_NODE new entries; each entry is either a pointer
+ * to the next node, expressed as an offset in the trie memory (i.e. node ID
+ * multiplied by SUBNET_MAP_NUM_ENTRIES_PER_NODE), or a leaf value in the range
+ * SUBNET_ID_MIN .. SUBNET_ID_MAX
+ */
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_OFST 4
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_LEN 2
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MINNUM 1
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MAXNUM 124
+#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MAXNUM_MCDI2 508
+
+/* MC_CMD_SUBNET_MAP_SET_NODE_OUT msgresponse */
+#define MC_CMD_SUBNET_MAP_SET_NODE_OUT_LEN 0
+
+/* PORTRANGE_TREE_ENTRY structuredef */
+#define PORTRANGE_TREE_ENTRY_LEN 4
+/* key for branch nodes (<= key takes left branch, > key takes right branch),
+ * or magic value for leaf nodes
+ */
+#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_OFST 0
+#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_LEN 2
+#define PORTRANGE_TREE_ENTRY_LEAF_NODE_KEY 0xffff /* enum */
+#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_LBN 0
+#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_WIDTH 16
+/* final portrange ID for leaf nodes (don't care for branch nodes) */
+#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_OFST 2
+#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_LEN 2
+#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_LBN 16
+#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_WIDTH 16
+
+
+/***********************************/
+/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE
+ * Atomically update the entire tree mapping remote port ranges to portrange
+ * IDs. The constants in the descriptions of the fields of this message may be
+ * retrieved by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO.
+ * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE 0x115
+#undef MC_CMD_0x115_PRIVILEGE_CTG
+
+#define MC_CMD_0x115_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN msgrequest */
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMIN 4
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMAX 252
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMAX_MCDI2 1020
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LEN(num) (0+4*(num))
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_NUM(len) (((len)-0)/4)
+/* PORTRANGE_TREE_NUM_ENTRIES new entries, each laid out as a
+ * PORTRANGE_TREE_ENTRY
+ */
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_OFST 0
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_LEN 4
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MINNUM 1
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM 63
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM_MCDI2 255
+
+/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_OUT msgresponse */
+#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE
+ * Atomically update the entire tree mapping remote port ranges to portrange
+ * IDs. The constants in the descriptions of the fields of this message may be
+ * retrieved by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO.
+ * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
+ * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
+ * been used in any released code and may change during development. This note
+ * will be removed once it is regarded as stable.
+ */
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE 0x116
+#undef MC_CMD_0x116_PRIVILEGE_CTG
+
+#define MC_CMD_0x116_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN msgrequest */
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMIN 4
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMAX 252
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMAX_MCDI2 1020
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LEN(num) (0+4*(num))
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_NUM(len) (((len)-0)/4)
+/* PORTRANGE_TREE_NUM_ENTRIES new entries, each laid out as a
+ * PORTRANGE_TREE_ENTRY
+ */
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_OFST 0
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_LEN 4
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MINNUM 1
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM 63
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM_MCDI2 255
+
+/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_OUT msgresponse */
+#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_OUT_LEN 0
+
/* TUNNEL_ENCAP_UDP_PORT_ENTRY structuredef */
#define TUNNEL_ENCAP_UDP_PORT_ENTRY_LEN 4
/* UDP port (the standard ports are named below but any port may be used) */
@@ -23058,7 +24397,7 @@
#define MC_CMD_RX_BALANCING 0x118
#undef MC_CMD_0x118_PRIVILEGE_CTG

-#define MC_CMD_0x118_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x118_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_RX_BALANCING_IN msgrequest */
#define MC_CMD_RX_BALANCING_IN_LEN 16
@@ -23079,6 +24418,627 @@
#define MC_CMD_RX_BALANCING_OUT_LEN 0


+/***********************************/
+/* MC_CMD_TSA_BIND
+ * TSAN - TSAC binding communication protocol. Refer to SF-115479-TC for more
+ * info in respect to the binding protocol.
+ */
+#define MC_CMD_TSA_BIND 0x119
+#undef MC_CMD_0x119_PRIVILEGE_CTG
+
+#define MC_CMD_0x119_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_TSA_BIND_IN msgrequest: Protocol operation code */
+#define MC_CMD_TSA_BIND_IN_LEN 4
+#define MC_CMD_TSA_BIND_IN_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_OP_LEN 4
+/* enum: Obsolete. Use MC_CMD_SECURE_NIC_INFO_IN_STATUS. */
+#define MC_CMD_TSA_BIND_OP_GET_ID 0x1
+/* enum: Get a binding ticket from the TSAN. The binding ticket is used as part
+ * of the binding procedure to authorize the binding of an adapter to a TSAID.
+ * Refer to SF-114946-SW for more information. This sub-command is only
+ * available over a TLS secure connection between the TSAN and TSAC.
+ */
+#define MC_CMD_TSA_BIND_OP_GET_TICKET 0x2
+/* enum: Opcode associated with the propagation of a private key that TSAN uses
+ * as part of post-binding authentication procedure. More specifically, TSAN
+ * uses this key for a signing operation. TSAC uses the counterpart public key
+ * to verify the signature. Note - The post-binding authentication occurs when
+ * the TSAN-TSAC connection terminates and TSAN tries to reconnect. Refer to
+ * SF-114946-SW for more information. This sub-command is only available over a
+ * TLS secure connection between the TSAN and TSAC.
+ */
+#define MC_CMD_TSA_BIND_OP_SET_KEY 0x3
+/* enum: Request an insecure unbinding operation. This sub-command is available
+ * for any privileged client.
+ */
+#define MC_CMD_TSA_BIND_OP_UNBIND 0x4
+/* enum: Obsolete. Use MC_CMD_TSA_BIND_OP_SECURE_UNBIND. */
+#define MC_CMD_TSA_BIND_OP_UNBIND_EXT 0x5
+/* enum: Opcode associated with the propagation of the unbinding secret token.
+ * TSAN persists the unbinding secret token. Refer to SF-115479-TC for more
+ * information. This sub-command is only available over a TLS secure connection
+ * between the TSAN and TSAC.
+ */
+#define MC_CMD_TSA_BIND_OP_SET_UNBINDTOKEN 0x6
+/* enum: Obsolete. Use MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION. */
+#define MC_CMD_TSA_BIND_OP_DECOMMISSION 0x7
+/* enum: Obsolete. Use MC_CMD_GET_CERTIFICATE. */
+#define MC_CMD_TSA_BIND_OP_GET_CERTIFICATE 0x8
+/* enum: Request a secure unbinding operation using unbinding token. This sub-
+ * command is available for any privileged client.
+ */
+#define MC_CMD_TSA_BIND_OP_SECURE_UNBIND 0x9
+/* enum: Request a secure decommissioning operation. This sub-command is
+ * available for any privileged client.
+ */
+#define MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION 0xa
+/* enum: Test facility that allows an adapter to be configured to behave as if
+ * Bound to a TSA controller with restricted MCDI administrator operations.
+ * This operation is primarily intended to aid host driver development.
+ */
+#define MC_CMD_TSA_BIND_OP_TEST_MCDI 0xb
+
+/* MC_CMD_TSA_BIND_IN_GET_ID msgrequest: Obsolete. Use
+ * MC_CMD_SECURE_NIC_INFO_IN_STATUS.
+ */
+#define MC_CMD_TSA_BIND_IN_GET_ID_LEN 20
+/* The operation requested. */
+#define MC_CMD_TSA_BIND_IN_GET_ID_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_GET_ID_OP_LEN 4
+/* Cryptographic nonce that TSAC generates and sends to TSAN. TSAC generates
+ * the nonce every time as part of the TSAN post-binding authentication
+ * procedure when the TSAN-TSAC connection terminates and TSAN does need to re-
+ * connect to the TSAC. Refer to SF-114946-SW for more information.
+ */
+#define MC_CMD_TSA_BIND_IN_GET_ID_NONCE_OFST 4
+#define MC_CMD_TSA_BIND_IN_GET_ID_NONCE_LEN 16
+
+/* MC_CMD_TSA_BIND_IN_GET_TICKET msgrequest */
+#define MC_CMD_TSA_BIND_IN_GET_TICKET_LEN 4
+/* The operation requested. */
+#define MC_CMD_TSA_BIND_IN_GET_TICKET_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_GET_TICKET_OP_LEN 4
+
+/* MC_CMD_TSA_BIND_IN_SET_KEY msgrequest */
+#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMIN 5
+#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMAX 252
+#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMAX_MCDI2 1020
+#define MC_CMD_TSA_BIND_IN_SET_KEY_LEN(num) (4+1*(num))
+#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_NUM(len) (((len)-4)/1)
+/* The operation requested. */
+#define MC_CMD_TSA_BIND_IN_SET_KEY_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_SET_KEY_OP_LEN 4
+/* This data blob contains the private key generated by the TSAC. TSAN uses
+ * this key for a signing operation. Note- This private key is used in
+ * conjunction with the post-binding TSAN authentication procedure that occurs
+ * when the TSAN-TSAC connection terminates and TSAN tries to reconnect. Refer
+ * to SF-114946-SW for more information.
+ */
+#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_OFST 4
+#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_LEN 1
+#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MINNUM 1
+#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MAXNUM 248
+#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MAXNUM_MCDI2 1016
+
+/* MC_CMD_TSA_BIND_IN_UNBIND msgrequest: Request an insecure unbinding
+ * operation.
+ */
+#define MC_CMD_TSA_BIND_IN_UNBIND_LEN 10
+/* The operation requested. */
+#define MC_CMD_TSA_BIND_IN_UNBIND_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_UNBIND_OP_LEN 4
+/* TSAN unique identifier for the network adapter */
+#define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_OFST 4
+#define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_LEN 6
+
+/* MC_CMD_TSA_BIND_IN_UNBIND_EXT msgrequest: Obsolete. Use
+ * MC_CMD_TSA_BIND_IN_SECURE_UNBIND.
+ */
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMIN 93
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMAX 252
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMAX_MCDI2 1020
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LEN(num) (92+1*(num))
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_NUM(len) (((len)-92)/1)
+/* The operation requested. */
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_OP_LEN 4
+/* TSAN unique identifier for the network adapter */
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_OFST 4
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_LEN 6
+/* Align the arguments to 32 bits */
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_RSVD_OFST 10
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_RSVD_LEN 2
+/* This attribute identifies the TSA infrastructure domain. The length of the
+ * TSAID attribute is limited to 64 bytes. This is how TSA SDK defines the max
+ * length. Note- The TSAID is the Organizational Unit Name filed as part of the
+ * root and server certificates.
+ */
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_OFST 12
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_LEN 1
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_NUM 64
+/* Unbinding secret token. The adapter validates this unbinding token by
+ * comparing it against the one stored on the adapter as part of the
+ * MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest. Refer to SF-115479-TC for
+ * more information.
+ */
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_UNBINDTOKEN_OFST 76
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_UNBINDTOKEN_LEN 16
+/* This is the signature of the above mentioned fields- TSANID, TSAID and
+ * UNBINDTOKEN. As per current requirements, the SIG opaque data blob contains
+ * ECDSA ECC-384 based signature. The ECC curve is secp384r1. The signature is
+ * also ASN-1 encoded. Note- The signature is verified based on the public key
+ * stored into the root certificate that is provisioned on the adapter side.
+ * This key is known as the PUKtsaid. Refer to SF-115479-TC for more
+ * information.
+ */
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_OFST 92
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_LEN 1
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MINNUM 1
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MAXNUM 160
+#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MAXNUM_MCDI2 928
+
+/* MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest */
+#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_LEN 20
+/* The operation requested. */
+#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_OP_LEN 4
+/* Unbinding secret token. TSAN persists the unbinding secret token. Refer to
+ * SF-115479-TC for more information.
+ */
+#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_UNBINDTOKEN_OFST 4
+#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_UNBINDTOKEN_LEN 16
+/* enum: There are situations when the binding process does not complete
+ * successfully due to key, other attributes corruption at the database level
+ * (Controller). Adapter can't connect to the controller anymore. To recover,
+ * make usage of the decommission command that forces the adapter into
+ * unbinding state.
+ */
+#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_ADAPTER_BINDING_FAILURE 0x1
+
+/* MC_CMD_TSA_BIND_IN_DECOMMISSION msgrequest: Obsolete. Use
+ * MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION.
+ */
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMIN 109
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMAX 252
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMAX_MCDI2 1020
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LEN(num) (108+1*(num))
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_NUM(len) (((len)-108)/1)
+/* This is the signature of the above mentioned fields- TSAID, USER and REASON.
+ * As per current requirements, the SIG opaque data blob contains ECDSA ECC-384
+ * based signature. The ECC curve is secp384r1. The signature is also ASN-1
+ * encoded . Note- The signature is verified based on the public key stored
+ * into the root certificate that is provisioned on the adapter side. This key
+ * is known as the PUKtsaid. Refer to SF-115479-TC for more information.
+ */
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_OFST 108
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_LEN 1
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MINNUM 1
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MAXNUM 144
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MAXNUM_MCDI2 912
+/* The operation requested. */
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_OP_LEN 4
+/* This attribute identifies the TSA infrastructure domain. The length of the
+ * TSAID attribute is limited to 64 bytes. This is how TSA SDK defines the max
+ * length. Note- The TSAID is the Organizational Unit Name filed as part of the
+ * root and server certificates.
+ */
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_OFST 4
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_LEN 1
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_NUM 64
+/* User ID that comes, as an example, from the Controller. Note- The 33 byte
+ * length of this attribute is max length of the linux user name plus null
+ * character.
+ */
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_OFST 68
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_LEN 1
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_NUM 33
+/* Align the arguments to 32 bits */
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_RSVD_OFST 101
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_RSVD_LEN 3
+/* Reason of why decommissioning happens Note- The list of reasons, defined as
+ * part of the enumeration below, can be extended.
+ */
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_REASON_OFST 104
+#define MC_CMD_TSA_BIND_IN_DECOMMISSION_REASON_LEN 4
+
+/* MC_CMD_TSA_BIND_IN_GET_CERTIFICATE msgrequest: Obsolete. Use
+ * MC_CMD_GET_CERTIFICATE.
+ */
+#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_LEN 8
+/* The operation requested, must be MC_CMD_TSA_BIND_OP_GET_CERTIFICATE. */
+#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_OP_LEN 4
+/* Type of the certificate to be retrieved. */
+#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_TYPE_OFST 4
+#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_TYPE_LEN 4
+#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_UNUSED 0x0 /* enum */
+/* enum: Adapter Authentication Certificate (AAC). The AAC is used by the
+ * controller to verify the authenticity of the adapter.
+ */
+#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_AAC 0x1
+/* enum: Adapter Authentication Signing Certificate (AASC). The AASC is used by
+ * the controller to verify the validity of AAC.
+ */
+#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_AASC 0x2
+
+/* MC_CMD_TSA_BIND_IN_SECURE_UNBIND msgrequest: Request a secure unbinding
+ * operation using unbinding token.
+ */
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMIN 97
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMAX 200
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMAX_MCDI2 200
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LEN(num) (96+1*(num))
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_NUM(len) (((len)-96)/1)
+/* The operation requested, must be MC_CMD_TSA_BIND_OP_SECURE_UNBIND. */
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_OP_LEN 4
+/* Type of the message. (MESSAGE_TYPE_xxx) Must be
+ * MESSAGE_TYPE_TSA_SECURE_UNBIND.
+ */
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_MESSAGE_TYPE_OFST 4
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_MESSAGE_TYPE_LEN 4
+/* TSAN unique identifier for the network adapter */
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_OFST 8
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_LEN 6
+/* Align the arguments to 32 bits */
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_RSVD_OFST 14
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_RSVD_LEN 2
+/* A NUL padded US-ASCII string identifying the TSA infrastructure domain. This
+ * field is for information only, and not used by the firmware. Note- The TSAID
+ * is the Organizational Unit Name field as part of the root and server
+ * certificates.
+ */
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_OFST 16
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_LEN 1
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_NUM 64
+/* Unbinding secret token. The adapter validates this unbinding token by
+ * comparing it against the one stored on the adapter as part of the
+ * MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest. Refer to SF-115479-TC for
+ * more information.
+ */
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_UNBINDTOKEN_OFST 80
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_UNBINDTOKEN_LEN 16
+/* The signature computed and encoded as specified by MESSAGE_TYPE. */
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_OFST 96
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_LEN 1
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MINNUM 1
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MAXNUM 104
+#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MAXNUM_MCDI2 104
+
+/* MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION msgrequest: Request a secure
+ * decommissioning operation.
+ */
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMIN 113
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMAX 216
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMAX_MCDI2 216
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LEN(num) (112+1*(num))
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_NUM(len) (((len)-112)/1)
+/* The operation requested, must be MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION. */
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_OP_LEN 4
+/* Type of the message. (MESSAGE_TYPE_xxx) Must be
+ * MESSAGE_TYPE_SECURE_DECOMMISSION.
+ */
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_MESSAGE_TYPE_OFST 4
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_MESSAGE_TYPE_LEN 4
+/* A NUL padded US-ASCII string identifying the TSA infrastructure domain. This
+ * field is for information only, and not used by the firmware. Note- The TSAID
+ * is the Organizational Unit Name field as part of the root and server
+ * certificates.
+ */
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_OFST 8
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_LEN 1
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_NUM 64
+/* A NUL padded US-ASCII string containing user name of the creator of the
+ * decommissioning ticket. This field is for information only, and not used by
+ * the firmware.
+ */
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_OFST 72
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_LEN 1
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_NUM 36
+/* Reason of why decommissioning happens */
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_REASON_OFST 108
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_REASON_LEN 4
+/* enum: There are situations when the binding process does not complete
+ * successfully due to key, other attributes corruption at the database level
+ * (Controller). Adapter can't connect to the controller anymore. To recover,
+ * use the decommission command to force the adapter into unbound state.
+ */
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_ADAPTER_BINDING_FAILURE 0x1
+/* The signature computed and encoded as specified by MESSAGE_TYPE. */
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_OFST 112
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_LEN 1
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MINNUM 1
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MAXNUM 104
+#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MAXNUM_MCDI2 104
+
+/* MC_CMD_TSA_BIND_IN_TEST_MCDI msgrequest: Test mode that emulates MCDI
+ * interface restrictions of a bound adapter. This operation is intended for
+ * test use on adapters that are not deployed and bound to a TSA Controller.
+ * Using it on a Bound adapter will succeed but will not alter the MCDI
+ * privileges as MCDI operations will already be restricted.
+ */
+#define MC_CMD_TSA_BIND_IN_TEST_MCDI_LEN 8
+/* The operation requested must be MC_CMD_TSA_BIND_OP_TEST_MCDI. */
+#define MC_CMD_TSA_BIND_IN_TEST_MCDI_OP_OFST 0
+#define MC_CMD_TSA_BIND_IN_TEST_MCDI_OP_LEN 4
+/* Enable or disable emulation of bound adapter */
+#define MC_CMD_TSA_BIND_IN_TEST_MCDI_CTRL_OFST 4
+#define MC_CMD_TSA_BIND_IN_TEST_MCDI_CTRL_LEN 4
+#define MC_CMD_TSA_BIND_IN_TEST_MCDI_DISABLE 0x0 /* enum */
+#define MC_CMD_TSA_BIND_IN_TEST_MCDI_ENABLE 0x1 /* enum */
+
+/* MC_CMD_TSA_BIND_OUT_GET_ID msgresponse: Obsolete. Use
+ * MC_CMD_SECURE_NIC_INFO_OUT_STATUS.
+ */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMIN 15
+#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMAX 252
+#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMAX_MCDI2 1020
+#define MC_CMD_TSA_BIND_OUT_GET_ID_LEN(num) (14+1*(num))
+#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_NUM(len) (((len)-14)/1)
+/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_ID that is sent back to
+ * the caller.
+ */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_OP_OFST 0
+#define MC_CMD_TSA_BIND_OUT_GET_ID_OP_LEN 4
+/* Rules engine type. Note- The rules engine type allows TSAC to further
+ * identify the connected endpoint (e.g. TSAN, NIC Emulator) type and take the
+ * proper action accordingly. As an example, TSAC uses the rules engine type to
+ * select the SF key that differs in the case of TSAN vs. NIC Emulator.
+ */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_OFST 4
+#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_LEN 4
+/* enum: Hardware rules engine. */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_TSAN 0x1
+/* enum: Nic emulator rules engine. */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_NEMU 0x2
+/* enum: SSFE. */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_SSFE 0x3
+/* TSAN unique identifier for the network adapter */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_OFST 8
+#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_LEN 6
+/* The signature data blob. The signature is computed against the message
+ * formed by TSAN ID concatenated with the NONCE value. Refer to SF-115479-TC
+ * for more information also in respect to the private keys that are used to
+ * sign the message based on TSAN pre/post-binding authentication procedure.
+ */
+#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_OFST 14
+#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_LEN 1
+#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MINNUM 1
+#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM 238
+#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM_MCDI2 1006
+
+/* MC_CMD_TSA_BIND_OUT_GET_TICKET msgresponse */
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMIN 5
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMAX 252
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMAX_MCDI2 1020
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LEN(num) (4+1*(num))
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_NUM(len) (((len)-4)/1)
+/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_TICKET that is sent back
+ * to the caller.
+ */
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_OP_OFST 0
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_OP_LEN 4
+/* The ticket represents the data blob construct that TSAN sends to TSAC as
+ * part of the binding protocol. From the TSAN perspective the ticket is an
+ * opaque construct. For more info refer to SF-115479-TC.
+ */
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_OFST 4
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_LEN 1
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MINNUM 1
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MAXNUM 248
+#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MAXNUM_MCDI2 1016
+
+/* MC_CMD_TSA_BIND_OUT_SET_KEY msgresponse */
+#define MC_CMD_TSA_BIND_OUT_SET_KEY_LEN 4
+/* The protocol operation code MC_CMD_TSA_BIND_OP_SET_KEY that is sent back to
+ * the caller.
+ */
+#define MC_CMD_TSA_BIND_OUT_SET_KEY_OP_OFST 0
+#define MC_CMD_TSA_BIND_OUT_SET_KEY_OP_LEN 4
+
+/* MC_CMD_TSA_BIND_OUT_UNBIND msgresponse: Response to insecure unbind request.
+ */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_LEN 8
+/* Same as MC_CMD_ERR field, but included as 0 in success cases */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_RESULT_OFST 0
+#define MC_CMD_TSA_BIND_OUT_UNBIND_RESULT_LEN 4
+/* Extra status information */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_INFO_OFST 4
+#define MC_CMD_TSA_BIND_OUT_UNBIND_INFO_LEN 4
+/* enum: Unbind successful. */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_OK_UNBOUND 0x0
+/* enum: TSANID mismatch */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_BAD_TSANID 0x1
+/* enum: Unable to remove the binding ticket from persistent storage. */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_REMOVE_TICKET 0x2
+/* enum: TSAN is not bound to a binding ticket. */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_NOT_BOUND 0x3
+
+/* MC_CMD_TSA_BIND_OUT_UNBIND_EXT msgresponse: Obsolete. Use
+ * MC_CMD_TSA_BIND_OUT_SECURE_UNBIND.
+ */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_LEN 8
+/* Same as MC_CMD_ERR field, but included as 0 in success cases */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_RESULT_OFST 0
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_RESULT_LEN 4
+/* Extra status information */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_INFO_OFST 4
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_INFO_LEN 4
+/* enum: Unbind successful. */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_OK_UNBOUND 0x0
+/* enum: TSANID mismatch */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_TSANID 0x1
+/* enum: Unable to remove the binding ticket from persistent storage. */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_REMOVE_TICKET 0x2
+/* enum: TSAN is not bound to a binding ticket. */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_NOT_BOUND 0x3
+/* enum: Invalid unbind token */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_TOKEN 0x4
+/* enum: Invalid signature */
+#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_SIGNATURE 0x5
+
+/* MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN msgresponse */
+#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_LEN 4
+/* The protocol operation code MC_CMD_TSA_BIND_OP_SET_UNBINDTOKEN that is sent
+ * back to the caller.
+ */
+#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_OP_OFST 0
+#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_OP_LEN 4
+
+/* MC_CMD_TSA_BIND_OUT_DECOMMISSION msgresponse: Obsolete. Use
+ * MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION.
+ */
+#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_LEN 4
+/* The protocol operation code MC_CMD_TSA_BIND_OP_DECOMMISSION that is sent
+ * back to the caller.
+ */
+#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_OP_OFST 0
+#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_OP_LEN 4
+
+/* MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE msgresponse */
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMIN 9
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMAX 252
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMAX_MCDI2 1020
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LEN(num) (8+1*(num))
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_NUM(len) (((len)-8)/1)
+/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_CERTIFICATE that is sent
+ * back to the caller.
+ */
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_OP_OFST 0
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_OP_LEN 4
+/* Type of the certificate. */
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_TYPE_OFST 4
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_TYPE_LEN 4
+/* Enum values, see field(s): */
+/* MC_CMD_TSA_BIND_IN_GET_CERTIFICATE/TYPE */
+/* The certificate data. */
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_OFST 8
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_LEN 1
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MINNUM 1
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MAXNUM 244
+#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MAXNUM_MCDI2 1012
+
+/* MC_CMD_TSA_BIND_OUT_SECURE_UNBIND msgresponse: Response to secure unbind
+ * request.
+ */
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_LEN 8
+/* The protocol operation code that is sent back to the caller. */
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OP_OFST 0
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OP_LEN 4
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_RESULT_OFST 4
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_RESULT_LEN 4
+/* enum: Unbind successful. */
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OK_UNBOUND 0x0
+/* enum: TSANID mismatch */
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_TSANID 0x1
+/* enum: Unable to remove the binding ticket from persistent storage. */
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_REMOVE_TICKET 0x2
+/* enum: TSAN is not bound to a domain. */
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_NOT_BOUND 0x3
+/* enum: Invalid unbind token */
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_TOKEN 0x4
+/* enum: Invalid signature */
+#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_SIGNATURE 0x5
+
+/* MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION msgresponse: Response to secure
+ * decommission request.
+ */
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_LEN 8
+/* The protocol operation code that is sent back to the caller. */
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OP_OFST 0
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OP_LEN 4
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_RESULT_OFST 4
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_RESULT_LEN 4
+/* enum: Unbind successful. */
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OK_UNBOUND 0x0
+/* enum: TSANID mismatch */
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_TSANID 0x1
+/* enum: Unable to remove the binding ticket from persistent storage. */
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_REMOVE_TICKET 0x2
+/* enum: TSAN is not bound to a domain. */
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_NOT_BOUND 0x3
+/* enum: Invalid unbind token */
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_TOKEN 0x4
+/* enum: Invalid signature */
+#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_SIGNATURE 0x5
+
+/* MC_CMD_TSA_BIND_OUT_TEST_MCDI msgrequest */
+#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_LEN 4
+/* The protocol operation code MC_CMD_TSA_BIND_OP_TEST_MCDI that is sent back
+ * to the caller.
+ */
+#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_OP_OFST 0
+#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_OP_LEN 4
+
+
+/***********************************/
+/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE
+ * Manage the persistent NVRAM cache of security rules created with
+ * MC_CMD_SET_SECURITY_RULE. Note that the cache is not automatically updated
+ * as rules are added or removed; the active ruleset must be explicitly
+ * committed to the cache. The cache may also be explicitly invalidated,
+ * without affecting the currently active ruleset. When the cache is valid, it
+ * will be loaded at power on or MC reboot, instead of the default ruleset.
+ * Rollback of the currently active ruleset to the cached version (when it is
+ * valid) is also supported. (Medford-only; for use by SolarSecure apps, not
+ * directly by drivers. See SF-114946-SW.) NOTE - The only sub-operation
+ * allowed in an adapter bound to a TSA controller from the local host is
+ * OP_GET_CACHED_VERSION. All other sub-operations are prohibited.
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE 0x11a
+#undef MC_CMD_0x11a_PRIVILEGE_CTG
+
+#define MC_CMD_0x11a_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN msgrequest */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_LEN 4
+/* the operation to perform */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_OFST 0
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_LEN 4
+/* enum: reports the ruleset version that is cached in persistent storage but
+ * performs no other action
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_GET_CACHED_VERSION 0x0
+/* enum: rolls back the active state to the cached version. (May fail with
+ * ENOENT if there is no valid cached version.)
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_ROLLBACK 0x1
+/* enum: commits the active state to the persistent cache */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_COMMIT 0x2
+/* enum: invalidates the persistent cache without affecting the active state */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_INVALIDATE 0x3
+
+/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT msgresponse */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMIN 5
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMAX 252
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMAX_MCDI2 1020
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LEN(num) (4+1*(num))
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_NUM(len) (((len)-4)/1)
+/* indicates whether the persistent cache is valid (after completion of the
+ * requested operation in the case of rollback, commit, or invalidate)
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_OFST 0
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_LEN 4
+/* enum: persistent cache is invalid (the VERSION field will be empty in this
+ * case)
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_INVALID 0x0
+/* enum: persistent cache is valid */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_VALID 0x1
+/* cached ruleset version (after completion of the requested operation, in the
+ * case of rollback, commit, or invalidate) as an opaque hash value in the same
+ * form as MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION
+ */
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_OFST 4
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_LEN 1
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MINNUM 1
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MAXNUM 248
+#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MAXNUM_MCDI2 1016
+
+
/***********************************/
/* MC_CMD_NVRAM_PRIVATE_APPEND
* Append a single TLV to the MC_USAGE_TLV partition. Returns MC_CMD_ERR_EEXIST
@@ -23087,7 +25047,7 @@
#define MC_CMD_NVRAM_PRIVATE_APPEND 0x11c
#undef MC_CMD_0x11c_PRIVILEGE_CTG

-#define MC_CMD_0x11c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+#define MC_CMD_0x11c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND

/* MC_CMD_NVRAM_PRIVATE_APPEND_IN msgrequest */
#define MC_CMD_NVRAM_PRIVATE_APPEND_IN_LENMIN 9
@@ -23409,6 +25369,38 @@
#define MC_CMD_DEALLOCATE_TX_VFIFO_CP_OUT_LEN 0


+/***********************************/
+/* MC_CMD_REKEY
+ * This request causes the NIC to generate a new per-NIC key and program it
+ * into the write-once memory. During the process all flash partitions that are
+ * protected with a CMAC are verified with the old per-NIC key and then signed
+ * with the new per-NIC key. If the NIC has already reached its rekey limit the
+ * REKEY op will return MC_CMD_ERR_ERANGE. The REKEY op may block until
+ * completion or it may return 0 and continue processing, therefore the caller
+ * must poll at least once to confirm that the rekeying has completed. The POLL
+ * operation returns MC_CMD_ERR_EBUSY if the rekey process is still running
+ * otherwise it will return the result of the last completed rekey operation,
+ * or 0 if there has not been a previous rekey.
+ */
+#define MC_CMD_REKEY 0x123
+#undef MC_CMD_0x123_PRIVILEGE_CTG
+
+#define MC_CMD_0x123_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_REKEY_IN msgrequest */
+#define MC_CMD_REKEY_IN_LEN 4
+/* the type of operation requested */
+#define MC_CMD_REKEY_IN_OP_OFST 0
+#define MC_CMD_REKEY_IN_OP_LEN 4
+/* enum: Start the rekeying operation */
+#define MC_CMD_REKEY_IN_OP_REKEY 0x0
+/* enum: Poll for completion of the rekeying operation */
+#define MC_CMD_REKEY_IN_OP_POLL 0x1
+
+/* MC_CMD_REKEY_OUT msgresponse */
+#define MC_CMD_REKEY_OUT_LEN 0
+
+
/***********************************/
/* MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS
* This interface allows the host to find out how many common pool buffers are
@@ -23432,6 +25424,945 @@
#define MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS_OUT_ENG_LEN 4


+/***********************************/
+/* MC_CMD_SET_SECURITY_FUSES
+ * Change the security level of the adapter by setting bits in the write-once
+ * memory. The firmware maps each flag in the message to a set of one or more
+ * hardware-defined or software-defined bits and sets these bits in the write-
+ * once memory. For Medford the hardware-defined bits are defined in
+ * SF-112079-PS 5.3, the software-defined bits are defined in xpm.h. Returns 0
+ * if all of the required bits were set and returns MC_CMD_ERR_EIO if any of
+ * the required bits were not set.
+ */
+#define MC_CMD_SET_SECURITY_FUSES 0x126
+#undef MC_CMD_0x126_PRIVILEGE_CTG
+
+#define MC_CMD_0x126_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_SET_SECURITY_FUSES_IN msgrequest */
+#define MC_CMD_SET_SECURITY_FUSES_IN_LEN 4
+/* Flags specifying what type of security features are being set */
+#define MC_CMD_SET_SECURITY_FUSES_IN_FLAGS_OFST 0
+#define MC_CMD_SET_SECURITY_FUSES_IN_FLAGS_LEN 4
+#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_OFST 0
+#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_LBN 0
+#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_WIDTH 1
+#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_OFST 0
+#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_LBN 1
+#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_WIDTH 1
+#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_OFST 0
+#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_LBN 31
+#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_WIDTH 1
+
+/* MC_CMD_SET_SECURITY_FUSES_OUT msgresponse */
+#define MC_CMD_SET_SECURITY_FUSES_OUT_LEN 0
+
+/* MC_CMD_SET_SECURITY_FUSES_V2_OUT msgresponse */
+#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_LEN 4
+/* Flags specifying which security features are enforced on the NIC after the
+ * flags in the request have been applied. See
+ * MC_CMD_SET_SECURITY_FUSES_IN/FLAGS for flag definitions.
+ */
+#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_FLAGS_OFST 0
+#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_FLAGS_LEN 4
+
+
+/***********************************/
+/* MC_CMD_TSA_INFO
+ * Messages sent from TSA adapter to TSA controller. This command is only valid
+ * when the MCDI header has MESSAGE_TYPE set to MCDI_MESSAGE_TYPE_TSA. This
+ * command is not sent by the driver to the MC; it is sent from the MC to a TSA
+ * controller, being treated more like an alert message rather than a command;
+ * hence the MC does not expect a response in return. Doxbox reference
+ * SF-117371-SW
+ */
+#define MC_CMD_TSA_INFO 0x127
+#undef MC_CMD_0x127_PRIVILEGE_CTG
+
+#define MC_CMD_0x127_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_TSA_INFO_IN msgrequest */
+#define MC_CMD_TSA_INFO_IN_LEN 4
+#define MC_CMD_TSA_INFO_IN_OP_HDR_OFST 0
+#define MC_CMD_TSA_INFO_IN_OP_HDR_LEN 4
+#define MC_CMD_TSA_INFO_IN_OP_OFST 0
+#define MC_CMD_TSA_INFO_IN_OP_LBN 0
+#define MC_CMD_TSA_INFO_IN_OP_WIDTH 16
+/* enum: Information about recently discovered local IP address of the adapter
+ */
+#define MC_CMD_TSA_INFO_OP_LOCAL_IP 0x1
+/* enum: Information about a sampled packet that either - did not match any
+ * black/white-list filters and was allowed by the default filter or - did not
+ * match any black/white-list filters and was denied by the default filter
+ */
+#define MC_CMD_TSA_INFO_OP_PKT_SAMPLE 0x2
+/* enum: Information about an unbind or decommission attempt. */
+#define MC_CMD_TSA_INFO_OP_UNBIND 0x3
+
+/* MC_CMD_TSA_INFO_IN_LOCAL_IP msgrequest:
+ *
+ * The TSA controller maintains a list of IP addresses valid for each port of a
+ * TSA adapter. The TSA controller requires information from the adapter
+ * inorder to learn new IP addresses assigned to a physical port and to
+ * identify those that are no longer assigned to the physical port. For this
+ * purpose, the TSA adapter snoops ARP replys, gratuitous ARP requests and ARP
+ * probe packets seen on each physical port. This definition describes the
+ * format of the notification message sent from a TSA adapter to a TSA
+ * controller related to any information related to a change in IP address
+ * assignment for a port. Doxbox reference SF-117371.
+ *
+ * There may be a possibility of combining multiple notifications in a single
+ * message in future. When that happens, a new flag can be defined using the
+ * reserved bits to describe the extended format of this notification.
+ */
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_LEN 18
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_OP_HDR_OFST 0
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_OP_HDR_LEN 4
+/* Additional metadata describing the IP address information such as source of
+ * information retrieval, type of IP address, physical port number.
+ */
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_OFST 4
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_LEN 4
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_OFST 4
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_LBN 0
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_WIDTH 8
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_OFST 4
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_LBN 8
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_WIDTH 8
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_OFST 4
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_LBN 16
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_WIDTH 8
+/* enum: ARP reply sent out of the physical port */
+#define MC_CMD_TSA_INFO_IP_REASON_TX_ARP 0x0
+/* enum: ARP probe packet received on the physical port */
+#define MC_CMD_TSA_INFO_IP_REASON_RX_ARP_PROBE 0x1
+/* enum: Gratuitous ARP packet received on the physical port */
+#define MC_CMD_TSA_INFO_IP_REASON_RX_GRATUITOUS_ARP 0x2
+/* enum: DHCP ACK packet received on the physical port */
+#define MC_CMD_TSA_INFO_IP_REASON_RX_DHCP_ACK 0x3
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_OFST 4
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_LBN 24
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_WIDTH 1
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_OFST 4
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_LBN 25
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_WIDTH 7
+/* IPV4 address retrieved from the sampled packets. This field is relevant only
+ * when META_IPV4 is set to 1.
+ */
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_IPV4_ADDR_OFST 8
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_IPV4_ADDR_LEN 4
+/* Target MAC address retrieved from the sampled packet. */
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_OFST 12
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_LEN 1
+#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_NUM 6
+
+/* MC_CMD_TSA_INFO_IN_PKT_SAMPLE msgrequest:
+ *
+ * It is desireable for the TSA controller to learn the traffic pattern of
+ * packets seen at the network port being monitored. In order to learn about
+ * the traffic pattern, the TSA controller may want to sample packets seen at
+ * the network port. Based on the packet samples that the TSA controller
+ * receives from the adapter, the controller may choose to configure additional
+ * black-list or white-list rules to allow or block packets as required.
+ *
+ * Although the entire sampled packet as seen on the network port is available
+ * to the MC the length of sampled packet sent to controller is restricted by
+ * MCDI payload size. Besides, the TSA controller does not require the entire
+ * packet to make decisions about filter updates. Hence the packet sample being
+ * passed to the controller is truncated to 128 bytes. This length is large
+ * enough to hold the ethernet header, IP header and maximum length of
+ * supported L4 protocol headers (IPv4 only, but can hold IPv6 header too, if
+ * required in future).
+ *
+ * The intention is that any future changes to this message format that are not
+ * backwards compatible will be defined with a new operation code.
+ */
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_LEN 136
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_OP_HDR_OFST 0
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_OP_HDR_LEN 4
+/* Additional metadata describing the sampled packet */
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_OFST 4
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_LEN 4
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_OFST 4
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_LBN 0
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_WIDTH 8
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_OFST 4
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_LBN 8
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_WIDTH 1
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_OFST 4
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_LBN 9
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_WIDTH 7
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_OFST 4
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_LBN 16
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_WIDTH 4
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_OFST 4
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_LBN 16
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_WIDTH 1
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_OFST 4
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_LBN 17
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_WIDTH 1
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_OFST 4
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_LBN 18
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_WIDTH 1
+/* 128-byte raw prefix of the sampled packet which includes the ethernet
+ * header, IP header and L4 protocol header (only IPv4 supported initially).
+ * This provides the controller enough information about the packet sample to
+ * report traffic patterns seen on a network port and to make decisions
+ * concerning rule-set updates.
+ */
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_OFST 8
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_LEN 1
+#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_NUM 128
+
+/* MC_CMD_TSA_INFO_IN_UNBIND msgrequest: Information about an unbind or
+ * decommission attempt. The purpose of this event is to let the controller
+ * know about unbind and decommission attempts (both successful and failed)
+ * received from the adapter host. The event is not sent if the unbind or
+ * decommission request was received from the controller.
+ */
+#define MC_CMD_TSA_INFO_IN_UNBIND_LEN 12
+#define MC_CMD_TSA_INFO_IN_UNBIND_OP_HDR_OFST 0
+#define MC_CMD_TSA_INFO_IN_UNBIND_OP_HDR_LEN 4
+#define MC_CMD_TSA_INFO_IN_UNBIND_OP_OFST 0
+#define MC_CMD_TSA_INFO_IN_UNBIND_OP_LBN 0
+#define MC_CMD_TSA_INFO_IN_UNBIND_OP_WIDTH 16
+/* Type of the unbind attempt. */
+#define MC_CMD_TSA_INFO_IN_UNBIND_TYPE_OFST 4
+#define MC_CMD_TSA_INFO_IN_UNBIND_TYPE_LEN 4
+/* enum: This event is sent because MC_CMD_TSA_BIND_OP_SECURE_UNBIND was
+ * received from the adapter local host.
+ */
+#define MC_CMD_TSA_INFO_UNBIND_TYPE_SECURE_UNBIND 0x1
+/* enum: This event is sent because MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION was
+ * received from the adapter local host.
+ */
+#define MC_CMD_TSA_INFO_UNBIND_TYPE_SECURE_DECOMMISSION 0x2
+/* Result of the attempt. */
+#define MC_CMD_TSA_INFO_IN_UNBIND_RESULT_OFST 8
+#define MC_CMD_TSA_INFO_IN_UNBIND_RESULT_LEN 4
+/* Enum values, see field(s): */
+/* MC_CMD_TSA_BIND/MC_CMD_TSA_BIND_OUT_SECURE_UNBIND/RESULT */
+
+/* MC_CMD_TSA_INFO_OUT msgresponse */
+#define MC_CMD_TSA_INFO_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_HOST_INFO
+ * Commands to appply or retrieve host-related information from an adapter.
+ * Doxbox reference SF-117371-SW
+ */
+#define MC_CMD_HOST_INFO 0x128
+#undef MC_CMD_0x128_PRIVILEGE_CTG
+
+#define MC_CMD_0x128_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_HOST_INFO_IN msgrequest */
+#define MC_CMD_HOST_INFO_IN_LEN 4
+/* sub-operation code info */
+#define MC_CMD_HOST_INFO_IN_OP_HDR_OFST 0
+#define MC_CMD_HOST_INFO_IN_OP_HDR_LEN 4
+#define MC_CMD_HOST_INFO_IN_OP_OFST 0
+#define MC_CMD_HOST_INFO_IN_OP_LBN 0
+#define MC_CMD_HOST_INFO_IN_OP_WIDTH 16
+/* enum: Read a 16-byte unique host identifier from the adapter. This UUID
+ * helps to identify the host that an adapter is plugged into. This identifier
+ * is ideally the system UUID retrieved and set by the UEFI driver. If the UEFI
+ * driver is unable to extract the system UUID, it would still set a random
+ * 16-byte value into each supported SF adapter plugged into it. Host UUIDs may
+ * change if the system is power-cycled, however, they persist across adapter
+ * resets. If the host UUID was not set on an adapter, due to an unsupported
+ * version of UEFI driver, then this command returns an error. Doxbox reference
+ * - SF-117371-SW section 'Host UUID'.
+ */
+#define MC_CMD_HOST_INFO_OP_GET_UUID 0x0
+/* enum: Set a 16-byte unique host identifier on the adapter to identify the
+ * host that the adapter is plugged into. See MC_CMD_HOST_INFO_OP_GET_UUID for
+ * further details.
+ */
+#define MC_CMD_HOST_INFO_OP_SET_UUID 0x1
+
+/* MC_CMD_HOST_INFO_IN_GET_UUID msgrequest */
+#define MC_CMD_HOST_INFO_IN_GET_UUID_LEN 4
+/* sub-operation code info */
+#define MC_CMD_HOST_INFO_IN_GET_UUID_OP_HDR_OFST 0
+#define MC_CMD_HOST_INFO_IN_GET_UUID_OP_HDR_LEN 4
+
+/* MC_CMD_HOST_INFO_OUT_GET_UUID msgresponse */
+#define MC_CMD_HOST_INFO_OUT_GET_UUID_LEN 16
+/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
+ * for further details.
+ */
+#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_OFST 0
+#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_LEN 1
+#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_NUM 16
+
+/* MC_CMD_HOST_INFO_IN_SET_UUID msgrequest */
+#define MC_CMD_HOST_INFO_IN_SET_UUID_LEN 20
+/* sub-operation code info */
+#define MC_CMD_HOST_INFO_IN_SET_UUID_OP_HDR_OFST 0
+#define MC_CMD_HOST_INFO_IN_SET_UUID_OP_HDR_LEN 4
+/* 16-byte host UUID set on the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID for
+ * further details.
+ */
+#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_OFST 4
+#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_LEN 1
+#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_NUM 16
+
+/* MC_CMD_HOST_INFO_OUT_SET_UUID msgresponse */
+#define MC_CMD_HOST_INFO_OUT_SET_UUID_LEN 0
+
+
+/***********************************/
+/* MC_CMD_TSAN_INFO
+ * Get TSA adapter information. TSA controllers query each TSA adapter to learn
+ * some configuration parameters of each adapter. Doxbox reference SF-117371-SW
+ * section 'Adapter Information'
+ */
+#define MC_CMD_TSAN_INFO 0x129
+#undef MC_CMD_0x129_PRIVILEGE_CTG
+
+#define MC_CMD_0x129_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_TSAN_INFO_IN msgrequest */
+#define MC_CMD_TSAN_INFO_IN_LEN 4
+/* sub-operation code info */
+#define MC_CMD_TSAN_INFO_IN_OP_HDR_OFST 0
+#define MC_CMD_TSAN_INFO_IN_OP_HDR_LEN 4
+#define MC_CMD_TSAN_INFO_IN_OP_OFST 0
+#define MC_CMD_TSAN_INFO_IN_OP_LBN 0
+#define MC_CMD_TSAN_INFO_IN_OP_WIDTH 16
+/* enum: Read configuration parameters and IDs that uniquely identify an
+ * adapter. The parameters include - host identification, adapter
+ * identification string and number of physical ports on the adapter.
+ */
+#define MC_CMD_TSAN_INFO_OP_GET_CFG 0x0
+
+/* MC_CMD_TSAN_INFO_IN_GET_CFG msgrequest */
+#define MC_CMD_TSAN_INFO_IN_GET_CFG_LEN 4
+/* sub-operation code info */
+#define MC_CMD_TSAN_INFO_IN_GET_CFG_OP_HDR_OFST 0
+#define MC_CMD_TSAN_INFO_IN_GET_CFG_OP_HDR_LEN 4
+
+/* MC_CMD_TSAN_INFO_OUT_GET_CFG msgresponse */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_LEN 26
+/* Information about the configuration parameters returned in this response. */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CONFIG_WORD_OFST 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CONFIG_WORD_LEN 4
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_OFST 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_LBN 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_WIDTH 16
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_OFST 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_LBN 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_WIDTH 1
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_OFST 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_LBN 16
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_WIDTH 8
+/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
+ * for further details.
+ */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_OFST 4
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_LEN 1
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_NUM 16
+/* A unique identifier per adapter. The base MAC address of the card is used
+ * for this purpose.
+ */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_OFST 20
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_LEN 1
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_NUM 6
+
+/* MC_CMD_TSAN_INFO_OUT_GET_CFG_V2 msgresponse */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_LEN 36
+/* Information about the configuration parameters returned in this response. */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CONFIG_WORD_OFST 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CONFIG_WORD_LEN 4
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_OFST 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_LBN 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_WIDTH 16
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_OFST 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_LBN 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_WIDTH 1
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_OFST 0
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_LBN 16
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_WIDTH 8
+/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
+ * for further details.
+ */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_OFST 4
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_LEN 1
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_NUM 16
+/* A unique identifier per adapter. The base MAC address of the card is used
+ * for this purpose.
+ */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_OFST 20
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_LEN 1
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_NUM 6
+/* Unused bytes, defined for 32-bit alignment of new fields. */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_UNUSED_OFST 26
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_UNUSED_LEN 2
+/* Maximum number of TSA statistics counters in each direction of dataflow
+ * supported on the card. Note that the statistics counters are always
+ * allocated in pairs, i.e. a counter ID is associated with one Tx and one Rx
+ * counter.
+ */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_MAX_STATS_OFST 28
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_MAX_STATS_LEN 4
+/* Width of each statistics counter (represented in bits). This gives an
+ * indication of wrap point to the user.
+ */
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_STATS_WIDTH_OFST 32
+#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_STATS_WIDTH_LEN 4
+
+
+/***********************************/
+/* MC_CMD_TSA_STATISTICS
+ * TSA adapter statistics operations.
+ */
+#define MC_CMD_TSA_STATISTICS 0x130
+#undef MC_CMD_0x130_PRIVILEGE_CTG
+
+#define MC_CMD_0x130_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_TSA_STATISTICS_IN msgrequest */
+#define MC_CMD_TSA_STATISTICS_IN_LEN 4
+/* TSA statistics sub-operation code */
+#define MC_CMD_TSA_STATISTICS_IN_OP_CODE_OFST 0
+#define MC_CMD_TSA_STATISTICS_IN_OP_CODE_LEN 4
+/* enum: Get the configuration parameters that describe the TSA statistics
+ * layout on the adapter.
+ */
+#define MC_CMD_TSA_STATISTICS_OP_GET_CONFIG 0x0
+/* enum: Read and/or clear TSA statistics counters. */
+#define MC_CMD_TSA_STATISTICS_OP_READ_CLEAR 0x1
+
+/* MC_CMD_TSA_STATISTICS_IN_GET_CONFIG msgrequest */
+#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_LEN 4
+/* TSA statistics sub-operation code */
+#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_OP_CODE_OFST 0
+#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_OP_CODE_LEN 4
+
+/* MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG msgresponse */
+#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_LEN 8
+/* Maximum number of TSA statistics counters in each direction of dataflow
+ * supported on the card. Note that the statistics counters are always
+ * allocated in pairs, i.e. a counter ID is associated with one Tx and one Rx
+ * counter.
+ */
+#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_MAX_STATS_OFST 0
+#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_MAX_STATS_LEN 4
+/* Width of each statistics counter (represented in bits). This gives an
+ * indication of wrap point to the user.
+ */
+#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_STATS_WIDTH_OFST 4
+#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_STATS_WIDTH_LEN 4
+
+/* MC_CMD_TSA_STATISTICS_IN_READ_CLEAR msgrequest */
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMIN 20
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMAX 252
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMAX_MCDI2 1020
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LEN(num) (16+4*(num))
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_NUM(len) (((len)-16)/4)
+/* TSA statistics sub-operation code */
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_OP_CODE_OFST 0
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_OP_CODE_LEN 4
+/* Parameters describing the statistics operation */
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_FLAGS_OFST 4
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_FLAGS_LEN 4
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_OFST 4
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_LBN 0
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_WIDTH 1
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_OFST 4
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_LBN 1
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_WIDTH 1
+/* Counter ID list specification type */
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_MODE_OFST 8
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_MODE_LEN 4
+/* enum: The statistics counters are specified as an unordered list of
+ * individual counter ID.
+ */
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LIST 0x0
+/* enum: The statistics counters are specified as a range of consecutive
+ * counter IDs.
+ */
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_RANGE 0x1
+/* Number of statistics counters */
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_NUM_STATS_OFST 12
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_NUM_STATS_LEN 4
+/* Counter IDs to be read/cleared. When mode is set to LIST, this entry holds a
+ * list of counter IDs to be operated on. When mode is set to RANGE, this entry
+ * holds a single counter ID representing the start of the range of counter IDs
+ * to be operated on.
+ */
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_OFST 16
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_LEN 4
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MINNUM 1
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MAXNUM 59
+#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MAXNUM_MCDI2 251
+
+/* MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR msgresponse */
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMIN 24
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMAX 248
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMAX_MCDI2 1016
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LEN(num) (8+16*(num))
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_NUM(len) (((len)-8)/16)
+/* Number of statistics counters returned in this response */
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_NUM_STATS_OFST 0
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_NUM_STATS_LEN 4
+/* MC_TSA_STATISTICS_ENTRY Note that this field is expected to start at a
+ * 64-bit aligned offset
+ */
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_OFST 8
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_LEN 16
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MINNUM 1
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MAXNUM 15
+#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MAXNUM_MCDI2 63
+
+/* MC_TSA_STATISTICS_ENTRY structuredef */
+#define MC_TSA_STATISTICS_ENTRY_LEN 16
+/* Tx statistics counter */
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_OFST 0
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LEN 8
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_OFST 0
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_LEN 4
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_LBN 0
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_WIDTH 32
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_OFST 4
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_LEN 4
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_LBN 32
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_WIDTH 32
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LBN 0
+#define MC_TSA_STATISTICS_ENTRY_TX_STAT_WIDTH 64
+/* Rx statistics counter */
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_OFST 8
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LEN 8
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_OFST 8
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_LEN 4
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_LBN 64
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_WIDTH 32
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_OFST 12
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_LEN 4
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_LBN 96
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_WIDTH 32
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LBN 64
+#define MC_TSA_STATISTICS_ENTRY_RX_STAT_WIDTH 64
+
+
+/***********************************/
+/* MC_CMD_ERASE_INITIAL_NIC_SECRET
+ * This request causes the NIC to find the initial NIC secret (programmed
+ * during ATE) in XPM memory and if and only if the NIC has already been
+ * rekeyed with MC_CMD_REKEY, erase it. This is used by manftest after
+ * installing TSA binding certificates. See SF-117631-TC.
+ */
+#define MC_CMD_ERASE_INITIAL_NIC_SECRET 0x131
+#undef MC_CMD_0x131_PRIVILEGE_CTG
+
+#define MC_CMD_0x131_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_ERASE_INITIAL_NIC_SECRET_IN msgrequest */
+#define MC_CMD_ERASE_INITIAL_NIC_SECRET_IN_LEN 0
+
+/* MC_CMD_ERASE_INITIAL_NIC_SECRET_OUT msgresponse */
+#define MC_CMD_ERASE_INITIAL_NIC_SECRET_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_TSA_CONFIG
+ * TSA adapter configuration operations. This command is used to prepare the
+ * NIC for TSA binding.
+ */
+#define MC_CMD_TSA_CONFIG 0x64
+#undef MC_CMD_0x64_PRIVILEGE_CTG
+
+#define MC_CMD_0x64_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_TSA_CONFIG_IN msgrequest */
+#define MC_CMD_TSA_CONFIG_IN_LEN 4
+/* TSA configuration sub-operation code */
+#define MC_CMD_TSA_CONFIG_IN_OP_OFST 0
+#define MC_CMD_TSA_CONFIG_IN_OP_LEN 4
+/* enum: Append a single item to the tsa_config partition. Items will be
+ * encrypted unless they are declared as non-sensitive. Returns
+ * MC_CMD_ERR_EEXIST if the tag is already present.
+ */
+#define MC_CMD_TSA_CONFIG_OP_APPEND 0x1
+/* enum: Reset the tsa_config partition to a clean state. */
+#define MC_CMD_TSA_CONFIG_OP_RESET 0x2
+/* enum: Read back a configured item from tsa_config partition. Returns
+ * MC_CMD_ERR_ENOENT if the item doesn't exist, or MC_CMD_ERR_EPERM if the item
+ * is declared as sensitive (i.e. is encrypted).
+ */
+#define MC_CMD_TSA_CONFIG_OP_READ 0x3
+
+/* MC_CMD_TSA_CONFIG_IN_APPEND msgrequest */
+#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMIN 12
+#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMAX 252
+#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMAX_MCDI2 1020
+#define MC_CMD_TSA_CONFIG_IN_APPEND_LEN(num) (12+1*(num))
+#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_NUM(len) (((len)-12)/1)
+/* TSA configuration sub-operation code. The value shall be
+ * MC_CMD_TSA_CONFIG_OP_APPEND.
+ */
+#define MC_CMD_TSA_CONFIG_IN_APPEND_OP_OFST 0
+#define MC_CMD_TSA_CONFIG_IN_APPEND_OP_LEN 4
+/* The tag to be appended */
+#define MC_CMD_TSA_CONFIG_IN_APPEND_TAG_OFST 4
+#define MC_CMD_TSA_CONFIG_IN_APPEND_TAG_LEN 4
+/* The length of the data in bytes */
+#define MC_CMD_TSA_CONFIG_IN_APPEND_LENGTH_OFST 8
+#define MC_CMD_TSA_CONFIG_IN_APPEND_LENGTH_LEN 4
+/* The item data */
+#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_OFST 12
+#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_LEN 1
+#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MINNUM 0
+#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MAXNUM 240
+#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MAXNUM_MCDI2 1008
+
+/* MC_CMD_TSA_CONFIG_OUT_APPEND msgresponse */
+#define MC_CMD_TSA_CONFIG_OUT_APPEND_LEN 0
+
+/* MC_CMD_TSA_CONFIG_IN_RESET msgrequest */
+#define MC_CMD_TSA_CONFIG_IN_RESET_LEN 4
+/* TSA configuration sub-operation code. The value shall be
+ * MC_CMD_TSA_CONFIG_OP_RESET.
+ */
+#define MC_CMD_TSA_CONFIG_IN_RESET_OP_OFST 0
+#define MC_CMD_TSA_CONFIG_IN_RESET_OP_LEN 4
+
+/* MC_CMD_TSA_CONFIG_OUT_RESET msgresponse */
+#define MC_CMD_TSA_CONFIG_OUT_RESET_LEN 0
+
+/* MC_CMD_TSA_CONFIG_IN_READ msgrequest */
+#define MC_CMD_TSA_CONFIG_IN_READ_LEN 8
+/* TSA configuration sub-operation code. The value shall be
+ * MC_CMD_TSA_CONFIG_OP_READ.
+ */
+#define MC_CMD_TSA_CONFIG_IN_READ_OP_OFST 0
+#define MC_CMD_TSA_CONFIG_IN_READ_OP_LEN 4
+/* The tag to be read */
+#define MC_CMD_TSA_CONFIG_IN_READ_TAG_OFST 4
+#define MC_CMD_TSA_CONFIG_IN_READ_TAG_LEN 4
+
+/* MC_CMD_TSA_CONFIG_OUT_READ msgresponse */
+#define MC_CMD_TSA_CONFIG_OUT_READ_LENMIN 8
+#define MC_CMD_TSA_CONFIG_OUT_READ_LENMAX 252
+#define MC_CMD_TSA_CONFIG_OUT_READ_LENMAX_MCDI2 1020
+#define MC_CMD_TSA_CONFIG_OUT_READ_LEN(num) (8+1*(num))
+#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_NUM(len) (((len)-8)/1)
+/* The tag that was read */
+#define MC_CMD_TSA_CONFIG_OUT_READ_TAG_OFST 0
+#define MC_CMD_TSA_CONFIG_OUT_READ_TAG_LEN 4
+/* The length of the data in bytes */
+#define MC_CMD_TSA_CONFIG_OUT_READ_LENGTH_OFST 4
+#define MC_CMD_TSA_CONFIG_OUT_READ_LENGTH_LEN 4
+/* The data of the item. */
+#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_OFST 8
+#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_LEN 1
+#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MINNUM 0
+#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MAXNUM 244
+#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MAXNUM_MCDI2 1012
+
+/* MC_TSA_IPV4_ITEM structuredef */
+#define MC_TSA_IPV4_ITEM_LEN 8
+/* Additional metadata describing the IP address information such as the
+ * physical port number the address is being used on. Unused space in this
+ * field is reserved for future expansion.
+ */
+#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_OFST 0
+#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_LEN 4
+#define MC_TSA_IPV4_ITEM_PORT_IDX_OFST 0
+#define MC_TSA_IPV4_ITEM_PORT_IDX_LBN 0
+#define MC_TSA_IPV4_ITEM_PORT_IDX_WIDTH 8
+#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_LBN 0
+#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_WIDTH 32
+/* The IPv4 address in little endian byte order. */
+#define MC_TSA_IPV4_ITEM_IPV4_ADDR_OFST 4
+#define MC_TSA_IPV4_ITEM_IPV4_ADDR_LEN 4
+#define MC_TSA_IPV4_ITEM_IPV4_ADDR_LBN 32
+#define MC_TSA_IPV4_ITEM_IPV4_ADDR_WIDTH 32
+
+
+/***********************************/
+/* MC_CMD_TSA_IPADDR
+ * TSA operations relating to the monitoring and expiry of local IP addresses
+ * discovered by the controller. These commands are sent from a TSA controller
+ * to a TSA adapter.
+ */
+#define MC_CMD_TSA_IPADDR 0x65
+#undef MC_CMD_0x65_PRIVILEGE_CTG
+
+#define MC_CMD_0x65_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_TSA_IPADDR_IN msgrequest */
+#define MC_CMD_TSA_IPADDR_IN_LEN 4
+/* Header containing information to identify which sub-operation of this
+ * command to perform. The header contains a 16-bit op-code. Unused space in
+ * this field is reserved for future expansion.
+ */
+#define MC_CMD_TSA_IPADDR_IN_OP_HDR_OFST 0
+#define MC_CMD_TSA_IPADDR_IN_OP_HDR_LEN 4
+#define MC_CMD_TSA_IPADDR_IN_OP_OFST 0
+#define MC_CMD_TSA_IPADDR_IN_OP_LBN 0
+#define MC_CMD_TSA_IPADDR_IN_OP_WIDTH 16
+/* enum: Request that the adapter verifies that the IPv4 addresses supplied are
+ * still in use by the host by sending ARP probes to the host. The MC does not
+ * wait for a response to the probes and sends an MCDI response to the
+ * controller once the probes have been sent to the host. The response to the
+ * probes (if there are any) will be forwarded to the controller using
+ * MC_CMD_TSA_INFO alerts.
+ */
+#define MC_CMD_TSA_IPADDR_OP_VALIDATE_IPV4 0x1
+/* enum: Notify the adapter that one or more IPv4 addresses are no longer valid
+ * for the host of the adapter. The adapter should remove the IPv4 addresses
+ * from its local cache.
+ */
+#define MC_CMD_TSA_IPADDR_OP_REMOVE_IPV4 0x2
+
+/* MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4 msgrequest */
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMIN 16
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMAX 248
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMAX_MCDI2 1016
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LEN(num) (8+8*(num))
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_NUM(len) (((len)-8)/8)
+/* Header containing information to identify which sub-operation of this
+ * command to perform. The header contains a 16-bit op-code. Unused space in
+ * this field is reserved for future expansion.
+ */
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_HDR_OFST 0
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_HDR_LEN 4
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_OFST 0
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_LBN 0
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_WIDTH 16
+/* Number of IPv4 addresses to validate. */
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_NUM_ITEMS_OFST 4
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_NUM_ITEMS_LEN 4
+/* The IPv4 addresses to validate, in struct MC_TSA_IPV4_ITEM format. */
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_OFST 8
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LEN 8
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_OFST 8
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_LEN 4
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_LBN 64
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_WIDTH 32
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_OFST 12
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_LEN 4
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_LBN 96
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_WIDTH 32
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MINNUM 1
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MAXNUM 30
+#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MAXNUM_MCDI2 126
+
+/* MC_CMD_TSA_IPADDR_OUT_VALIDATE_IPV4 msgresponse */
+#define MC_CMD_TSA_IPADDR_OUT_VALIDATE_IPV4_LEN 0
+
+/* MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4 msgrequest */
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMIN 16
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMAX 248
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMAX_MCDI2 1016
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LEN(num) (8+8*(num))
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_NUM(len) (((len)-8)/8)
+/* Header containing information to identify which sub-operation of this
+ * command to perform. The header contains a 16-bit op-code. Unused space in
+ * this field is reserved for future expansion.
+ */
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_HDR_OFST 0
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_HDR_LEN 4
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_OFST 0
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_LBN 0
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_WIDTH 16
+/* Number of IPv4 addresses to remove. */
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_NUM_ITEMS_OFST 4
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_NUM_ITEMS_LEN 4
+/* The IPv4 addresses that have expired, in struct MC_TSA_IPV4_ITEM format. */
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_OFST 8
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LEN 8
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_OFST 8
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_LEN 4
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_LBN 64
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_WIDTH 32
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_OFST 12
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_LEN 4
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_LBN 96
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_WIDTH 32
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MINNUM 1
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MAXNUM 30
+#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MAXNUM_MCDI2 126
+
+/* MC_CMD_TSA_IPADDR_OUT_REMOVE_IPV4 msgresponse */
+#define MC_CMD_TSA_IPADDR_OUT_REMOVE_IPV4_LEN 0
+
+
+/***********************************/
+/* MC_CMD_SECURE_NIC_INFO
+ * Get secure NIC information. While many of the features reported by these
+ * commands are related to TSA, they must be supported in firmware where TSA is
+ * disabled.
+ */
+#define MC_CMD_SECURE_NIC_INFO 0x132
+#undef MC_CMD_0x132_PRIVILEGE_CTG
+
+#define MC_CMD_0x132_PRIVILEGE_CTG SRIOV_CTG_GENERAL
+
+/* MC_CMD_SECURE_NIC_INFO_IN msgrequest */
+#define MC_CMD_SECURE_NIC_INFO_IN_LEN 4
+/* sub-operation code info */
+#define MC_CMD_SECURE_NIC_INFO_IN_OP_HDR_OFST 0
+#define MC_CMD_SECURE_NIC_INFO_IN_OP_HDR_LEN 4
+#define MC_CMD_SECURE_NIC_INFO_IN_OP_OFST 0
+#define MC_CMD_SECURE_NIC_INFO_IN_OP_LBN 0
+#define MC_CMD_SECURE_NIC_INFO_IN_OP_WIDTH 16
+/* enum: Get the status of various security settings, all signed along with a
+ * challenge chosen by the host.
+ */
+#define MC_CMD_SECURE_NIC_INFO_OP_STATUS 0x0
+
+/* MC_CMD_SECURE_NIC_INFO_IN_STATUS msgrequest */
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_LEN 24
+/* sub-operation code, must be MC_CMD_SECURE_NIC_INFO_OP_STATUS */
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_OP_HDR_OFST 0
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_OP_HDR_LEN 4
+/* Type of key to be used to sign response. */
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_KEY_TYPE_OFST 4
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_KEY_TYPE_LEN 4
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_UNUSED 0x0 /* enum */
+/* enum: Solarflare adapter authentication key, installed by Manftest. */
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_SF_ADAPTER_AUTH 0x1
+/* enum: TSA binding key, installed after adapter is bound to a TSA controller.
+ * This is not supported in firmware which does not support TSA.
+ */
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_TSA_BINDING 0x2
+/* enum: Customer adapter authentication key. Installed by the customer in the
+ * field, but otherwise similar to the Solarflare adapter authentication key.
+ */
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CUSTOMER_ADAPTER_AUTH 0x3
+/* Random challenge generated by the host. */
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CHALLENGE_OFST 8
+#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CHALLENGE_LEN 16
+
+/* MC_CMD_SECURE_NIC_INFO_OUT_STATUS msgresponse */
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_LEN 420
+/* Length of the signature in MSG_SIGNATURE. */
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN_OFST 0
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN_LEN 4
+/* Signature over the message, starting at MESSAGE_TYPE and continuing to the
+ * end of the MCDI response, allowing the message format to be extended. The
+ * signature uses ECDSA 384 encoding in ASN.1 format. It has variable length,
+ * with a maximum of 384 bytes.
+ */
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_OFST 4
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN 384
+/* Enum value indicating the type of response. This protects against chosen
+ * message attacks. The enum values are random rather than sequential to make
+ * it unlikely that values will be reused should other commands in a different
+ * namespace need to create signed messages.
+ */
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MESSAGE_TYPE_OFST 388
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MESSAGE_TYPE_LEN 4
+/* enum: Message type value for the response to a
+ * MC_CMD_SECURE_NIC_INFO_IN_STATUS message.
+ */
+#define MC_CMD_SECURE_NIC_INFO_STATUS 0xdb4
+/* The challenge provided by the host in the MC_CMD_SECURE_NIC_INFO_IN_STATUS
+ * message
+ */
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_CHALLENGE_OFST 392
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_CHALLENGE_LEN 16
+/* The first 32 bits of XPM memory, which include security and flag bits, die
+ * ID and chip ID revision. The meaning of these bits is defined in
+ * mc/include/mc/xpm.h in the firmwaresrc repository.
+ */
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_XPM_STATUS_BITS_OFST 408
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_XPM_STATUS_BITS_LEN 4
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_A_OFST 412
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_A_LEN 2
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_B_OFST 414
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_B_LEN 2
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_C_OFST 416
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_C_LEN 2
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_D_OFST 418
+#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_D_LEN 2
+
+
+/***********************************/
+/* MC_CMD_TSA_TEST
+ * A simple ping-pong command just to test the adapter<>controller MCDI
+ * communication channel. This command makes not changes to the TSA adapter's
+ * internal state. It is used by the controller just to verify that the MCDI
+ * communication channel is working fine. This command takes no additonal
+ * parameters in request or response.
+ */
+#define MC_CMD_TSA_TEST 0x125
+#undef MC_CMD_0x125_PRIVILEGE_CTG
+
+#define MC_CMD_0x125_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_TSA_TEST_IN msgrequest */
+#define MC_CMD_TSA_TEST_IN_LEN 0
+
+/* MC_CMD_TSA_TEST_OUT msgresponse */
+#define MC_CMD_TSA_TEST_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_TSA_RULESET_OVERRIDE
+ * Override TSA ruleset that is currently active on the adapter. This operation
+ * does not modify the ruleset itself. This operation provides a mechanism to
+ * apply an allow-all or deny-all operation on all packets, thereby completely
+ * ignoring the rule-set configured on the adapter. The main purpose of this
+ * operation is to provide a deterministic state to the TSA firewall during
+ * rule-set transitions.
+ */
+#define MC_CMD_TSA_RULESET_OVERRIDE 0x12a
+#undef MC_CMD_0x12a_PRIVILEGE_CTG
+
+#define MC_CMD_0x12a_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_TSA_RULESET_OVERRIDE_IN msgrequest */
+#define MC_CMD_TSA_RULESET_OVERRIDE_IN_LEN 4
+/* The override state to apply. */
+#define MC_CMD_TSA_RULESET_OVERRIDE_IN_STATE_OFST 0
+#define MC_CMD_TSA_RULESET_OVERRIDE_IN_STATE_LEN 4
+/* enum: No override in place - the existing ruleset is in operation. */
+#define MC_CMD_TSA_RULESET_OVERRIDE_NONE 0x0
+/* enum: Block all packets seen on all datapath channel except those packets
+ * required for basic configuration of the TSA NIC such as ARPs and TSA-
+ * communication traffic. Such exceptional traffic is handled differently
+ * compared to TSA rulesets.
+ */
+#define MC_CMD_TSA_RULESET_OVERRIDE_BLOCK 0x1
+/* enum: Allow all packets through all datapath channel. The TSA adapter
+ * behaves like a normal NIC without any firewalls.
+ */
+#define MC_CMD_TSA_RULESET_OVERRIDE_ALLOW 0x2
+
+/* MC_CMD_TSA_RULESET_OVERRIDE_OUT msgresponse */
+#define MC_CMD_TSA_RULESET_OVERRIDE_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_TSAC_REQUEST
+ * Generic command to send requests from a TSA controller to a TSA adapter.
+ * Specific usage is determined by the TYPE field.
+ */
+#define MC_CMD_TSAC_REQUEST 0x12b
+#undef MC_CMD_0x12b_PRIVILEGE_CTG
+
+#define MC_CMD_0x12b_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_TSAC_REQUEST_IN msgrequest */
+#define MC_CMD_TSAC_REQUEST_IN_LEN 4
+/* The type of request from the controller. */
+#define MC_CMD_TSAC_REQUEST_IN_TYPE_OFST 0
+#define MC_CMD_TSAC_REQUEST_IN_TYPE_LEN 4
+/* enum: Request the adapter to resend localIP information from it's cache. The
+ * command does not return any IP address information; IP addresses are sent as
+ * TSA notifications as descibed in MC_CMD_TSA_INFO_IN_LOCAL_IP.
+ */
+#define MC_CMD_TSAC_REQUEST_LOCALIP 0x0
+
+/* MC_CMD_TSAC_REQUEST_OUT msgresponse */
+#define MC_CMD_TSAC_REQUEST_OUT_LEN 0
+
+
/***********************************/
/* MC_CMD_SUC_VERSION
* Get the version of the SUC
@@ -23477,6 +26408,580 @@
#define MC_CMD_SUC_BOOT_VERSION_OUT_VERSION_LEN 4


+/***********************************/
+/* MC_CMD_SUC_MANFTEST
+ * Operations to support manftest on SUC based systems.
+ */
+#define MC_CMD_SUC_MANFTEST 0x135
+#undef MC_CMD_0x135_PRIVILEGE_CTG
+
+#define MC_CMD_0x135_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
+
+/* MC_CMD_SUC_MANFTEST_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_IN_LEN 4
+/* The manftest operation to be performed. */
+#define MC_CMD_SUC_MANFTEST_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_IN_OP_LEN 4
+/* enum: Read serial number and use count. */
+#define MC_CMD_SUC_MANFTEST_WEAROUT_READ 0x0
+/* enum: Update use count on wearout adapter. */
+#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE 0x1
+/* enum: Start an ADC calibration. */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START 0x2
+/* enum: Read the status of an ADC calibration. */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS 0x3
+/* enum: Read the results of an ADC calibration. */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT 0x4
+/* enum: Read the PCIe configuration. */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ 0x5
+/* enum: Write the PCIe configuration. */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE 0x6
+/* enum: Write FRU information to SUC. The FRU information is taken from the
+ * FRU_INFORMATION partition. Attempts to write to read-only FRUs are rejected.
+ */
+#define MC_CMD_SUC_MANFTEST_FRU_WRITE 0x7
+/* enum: Read UDID Vendor Specific ID from SUC persistent storage. */
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ 0x8
+/* enum: Write UDID Vendor Specific ID to SUC persistent storage for use in
+ * SMBus ARP.
+ */
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE 0x9
+
+/* MC_CMD_SUC_MANFTEST_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_OUT_LEN 0
+
+/* MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_LEN 4
+/* The manftest operation to be performed. This must be
+ * MC_CMD_SUC_MANFTEST_WEAROUT_READ.
+ */
+#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_OP_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_LEN 20
+/* The serial number of the wearout adapter, see SF-112717-PR for format. */
+#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_SERIAL_NUMBER_OFST 0
+#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_SERIAL_NUMBER_LEN 16
+/* The use count of the wearout adapter. */
+#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_USE_COUNT_OFST 16
+#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_USE_COUNT_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_LEN 4
+/* The manftest operation to be performed. This must be
+ * MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE.
+ */
+#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_OP_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_OUT_LEN 0
+
+/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_LEN 4
+/* The manftest operation to be performed. This must be
+ * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START.
+ */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_OP_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_OUT_LEN 0
+
+/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_LEN 4
+/* The manftest operation to be performed. This must be
+ * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS.
+ */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_OP_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_LEN 4
+/* The combined status of the calibration operation. */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FLAGS_OFST 0
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FLAGS_LEN 4
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_OFST 0
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_LBN 0
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_WIDTH 1
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_OFST 0
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_LBN 1
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_WIDTH 1
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_OFST 0
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_LBN 2
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_WIDTH 4
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_OFST 0
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_LBN 6
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_WIDTH 2
+
+/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_LEN 4
+/* The manftest operation to be performed. This must be
+ * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT.
+ */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_OP_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_LEN 12
+/* The set of calibration results. */
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_OFST 0
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_LEN 4
+#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_NUM 3
+
+/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_LEN 4
+/* The manftest operation to be performed. This must be
+ * MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ.
+ */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_OP_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_LEN 4
+/* The PCIe vendor ID. */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_VENDOR_ID_OFST 0
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_VENDOR_ID_LEN 2
+/* The PCIe device ID. */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_DEVICE_ID_OFST 2
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_DEVICE_ID_LEN 2
+
+/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_LEN 8
+/* The manftest operation to be performed. This must be
+ * MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE.
+ */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_OP_LEN 4
+/* The PCIe vendor ID. */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_VENDOR_ID_OFST 4
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_VENDOR_ID_LEN 2
+/* The PCIe device ID. */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_DEVICE_ID_OFST 6
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_DEVICE_ID_LEN 2
+
+/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_OUT_LEN 0
+
+/* MC_CMD_SUC_MANFTEST_FRU_WRITE_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_LEN 4
+/* The manftest operation to be performed. This must be
+ * MC_CMD_SUC_MANFTEST_FRU_WRITE
+ */
+#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_OP_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_FRU_WRITE_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_FRU_WRITE_OUT_LEN 0
+
+/* MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_LEN 4
+/* The manftest operation to be performed. This must be
+ * MC_CMD_SUC_MANFTEST_SMBUS_ID_READ.
+ */
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_OP_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_LEN 4
+/* The SMBus ID. */
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_SMBUS_ID_OFST 0
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_SMBUS_ID_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN msgrequest */
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_LEN 8
+/* The manftest operation to be performed. This must be
+ * MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE.
+ */
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_OP_OFST 0
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_OP_LEN 4
+/* The SMBus ID. */
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_SMBUS_ID_OFST 4
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_SMBUS_ID_LEN 4
+
+/* MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_OUT msgresponse */
+#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_GET_CERTIFICATE
+ * Request a certificate.
+ */
+#define MC_CMD_GET_CERTIFICATE 0x12c
+#undef MC_CMD_0x12c_PRIVILEGE_CTG
+
+#define MC_CMD_0x12c_PRIVILEGE_CTG SRIOV_CTG_GENERAL
+
+/* MC_CMD_GET_CERTIFICATE_IN msgrequest */
+#define MC_CMD_GET_CERTIFICATE_IN_LEN 8
+/* Type of the certificate to be retrieved. */
+#define MC_CMD_GET_CERTIFICATE_IN_TYPE_OFST 0
+#define MC_CMD_GET_CERTIFICATE_IN_TYPE_LEN 4
+#define MC_CMD_GET_CERTIFICATE_IN_UNUSED 0x0 /* enum */
+#define MC_CMD_GET_CERTIFICATE_IN_AAC 0x1 /* enum */
+/* enum: Adapter Authentication Certificate (AAC). The AAC is unique to each
+ * adapter and is used to verify its authenticity. It is installed by Manftest.
+ */
+#define MC_CMD_GET_CERTIFICATE_IN_ADAPTER_AUTH 0x1
+#define MC_CMD_GET_CERTIFICATE_IN_AASC 0x2 /* enum */
+/* enum: Adapter Authentication Signing Certificate (AASC). The AASC is shared
+ * by a group of adapters (typically a purchase order) and is used to verify
+ * the validity of AAC along with the SF root certificate. It is installed by
+ * Manftest.
+ */
+#define MC_CMD_GET_CERTIFICATE_IN_ADAPTER_AUTH_SIGNING 0x2
+#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_AAC 0x3 /* enum */
+/* enum: Customer Adapter Authentication Certificate. The Customer AAC is
+ * unique to each adapter and is used to verify its authenticity in cases where
+ * either the AAC is not installed or a customer desires to use their own
+ * certificate chain. It is installed by the customer.
+ */
+#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_ADAPTER_AUTH 0x3
+#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_AASC 0x4 /* enum */
+/* enum: Customer Adapter Authentication Certificate. The Customer AASC is
+ * shared by a group of adapters and is used to verify the validity of the
+ * Customer AAC along with the customers root certificate. It is installed by
+ * the customer.
+ */
+#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_ADAPTER_AUTH_SIGNING 0x4
+/* Offset, measured in bytes, relative to the start of the certificate data
+ * from which the certificate is to be retrieved.
+ */
+#define MC_CMD_GET_CERTIFICATE_IN_OFFSET_OFST 4
+#define MC_CMD_GET_CERTIFICATE_IN_OFFSET_LEN 4
+
+/* MC_CMD_GET_CERTIFICATE_OUT msgresponse */
+#define MC_CMD_GET_CERTIFICATE_OUT_LENMIN 13
+#define MC_CMD_GET_CERTIFICATE_OUT_LENMAX 252
+#define MC_CMD_GET_CERTIFICATE_OUT_LENMAX_MCDI2 1020
+#define MC_CMD_GET_CERTIFICATE_OUT_LEN(num) (12+1*(num))
+#define MC_CMD_GET_CERTIFICATE_OUT_DATA_NUM(len) (((len)-12)/1)
+/* Type of the certificate. */
+#define MC_CMD_GET_CERTIFICATE_OUT_TYPE_OFST 0
+#define MC_CMD_GET_CERTIFICATE_OUT_TYPE_LEN 4
+/* Enum values, see field(s): */
+/* MC_CMD_GET_CERTIFICATE_IN/TYPE */
+/* Offset, measured in bytes, relative to the start of the certificate data
+ * from which data in this message starts.
+ */
+#define MC_CMD_GET_CERTIFICATE_OUT_OFFSET_OFST 4
+#define MC_CMD_GET_CERTIFICATE_OUT_OFFSET_LEN 4
+/* Total length of the certificate data. */
+#define MC_CMD_GET_CERTIFICATE_OUT_TOTAL_LENGTH_OFST 8
+#define MC_CMD_GET_CERTIFICATE_OUT_TOTAL_LENGTH_LEN 4
+/* The certificate data. */
+#define MC_CMD_GET_CERTIFICATE_OUT_DATA_OFST 12
+#define MC_CMD_GET_CERTIFICATE_OUT_DATA_LEN 1
+#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MINNUM 1
+#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MAXNUM 240
+#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MAXNUM_MCDI2 1008
+
+
+/***********************************/
+/* MC_CMD_GET_NIC_GLOBAL
+ * Get a global value which applies to all PCI functions
+ */
+#define MC_CMD_GET_NIC_GLOBAL 0x12d
+#undef MC_CMD_0x12d_PRIVILEGE_CTG
+
+#define MC_CMD_0x12d_PRIVILEGE_CTG SRIOV_CTG_GENERAL
+
+/* MC_CMD_GET_NIC_GLOBAL_IN msgrequest */
+#define MC_CMD_GET_NIC_GLOBAL_IN_LEN 4
+/* Key to request value for, see enum values in MC_CMD_SET_NIC_GLOBAL. If the
+ * given key is unknown to the current firmware, the call will fail with
+ * ENOENT.
+ */
+#define MC_CMD_GET_NIC_GLOBAL_IN_KEY_OFST 0
+#define MC_CMD_GET_NIC_GLOBAL_IN_KEY_LEN 4
+
+/* MC_CMD_GET_NIC_GLOBAL_OUT msgresponse */
+#define MC_CMD_GET_NIC_GLOBAL_OUT_LEN 4
+/* Value of requested key, see key descriptions below. */
+#define MC_CMD_GET_NIC_GLOBAL_OUT_VALUE_OFST 0
+#define MC_CMD_GET_NIC_GLOBAL_OUT_VALUE_LEN 4
+
+
+/***********************************/
+/* MC_CMD_SET_NIC_GLOBAL
+ * Set a global value which applies to all PCI functions. Most global values
+ * can only be changed under specific conditions, and this call will return an
+ * appropriate error otherwise (see key descriptions).
+ */
+#define MC_CMD_SET_NIC_GLOBAL 0x12e
+#undef MC_CMD_0x12e_PRIVILEGE_CTG
+
+#define MC_CMD_0x12e_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_SET_NIC_GLOBAL_IN msgrequest */
+#define MC_CMD_SET_NIC_GLOBAL_IN_LEN 8
+/* Key to change value of. Firmware will return ENOENT for keys it doesn't know
+ * about.
+ */
+#define MC_CMD_SET_NIC_GLOBAL_IN_KEY_OFST 0
+#define MC_CMD_SET_NIC_GLOBAL_IN_KEY_LEN 4
+/* enum: Request switching the datapath firmware sub-variant. Currently only
+ * useful when running the DPDK f/w variant. See key values below, and the DPDK
+ * section of the EF10 Driver Writers Guide. Note that any driver attaching
+ * with the SUBVARIANT_AWARE flag cleared is implicitly considered as a request
+ * to switch back to the default sub-variant, and will thus reset this value.
+ * If a sub-variant switch happens, all other PCI functions will get their
+ * resources reset (they will see an MC reboot).
+ */
+#define MC_CMD_SET_NIC_GLOBAL_IN_FIRMWARE_SUBVARIANT 0x1
+/* New value to set, see key descriptions above. */
+#define MC_CMD_SET_NIC_GLOBAL_IN_VALUE_OFST 4
+#define MC_CMD_SET_NIC_GLOBAL_IN_VALUE_LEN 4
+/* enum: Only if KEY = FIRMWARE_SUBVARIANT. Default sub-variant with support
+ * for maximum features for the current f/w variant. A request from a
+ * privileged function to set this particular value will always succeed.
+ */
+#define MC_CMD_SET_NIC_GLOBAL_IN_FW_SUBVARIANT_DEFAULT 0x0
+/* enum: Only if KEY = FIRMWARE_SUBVARIANT. Increases packet rate at the cost
+ * of not supporting any TX checksum offloads. Only supported when running some
+ * f/w variants, others will return ENOTSUP (as reported by the homonymous bit
+ * in MC_CMD_GET_CAPABILITIES_V2). Can only be set when no other drivers are
+ * attached, and the calling driver must have no resources allocated. See the
+ * DPDK section of the EF10 Driver Writers Guide for a more detailed
+ * description with possible error codes.
+ */
+#define MC_CMD_SET_NIC_GLOBAL_IN_FW_SUBVARIANT_NO_TX_CSUM 0x1
+
+
+/***********************************/
+/* MC_CMD_LTSSM_TRACE_POLL
+ * Medford2 hardware has support for logging all LTSSM state transitions to a
+ * hardware buffer. When built with WITH_LTSSM_TRACE=1, the firmware will
+ * periodially dump the contents of this hardware buffer to an internal
+ * firmware buffer for later extraction.
+ */
+#define MC_CMD_LTSSM_TRACE_POLL 0x12f
+#undef MC_CMD_0x12f_PRIVILEGE_CTG
+
+#define MC_CMD_0x12f_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_LTSSM_TRACE_POLL_IN msgrequest: Read transitions from the firmware
+ * internal buffer.
+ */
+#define MC_CMD_LTSSM_TRACE_POLL_IN_LEN 4
+/* The maximum number of row that the caller can accept. The format of each row
+ * is defined in MC_CMD_LTSSM_TRACE_POLL_OUT.
+ */
+#define MC_CMD_LTSSM_TRACE_POLL_IN_MAX_ROW_COUNT_OFST 0
+#define MC_CMD_LTSSM_TRACE_POLL_IN_MAX_ROW_COUNT_LEN 4
+
+/* MC_CMD_LTSSM_TRACE_POLL_OUT msgresponse */
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMIN 16
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMAX 248
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMAX_MCDI2 1016
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_LEN(num) (8+8*(num))
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_NUM(len) (((len)-8)/8)
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_FLAGS_OFST 0
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_FLAGS_LEN 4
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_OFST 0
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_LBN 0
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_WIDTH 1
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_OFST 0
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_LBN 1
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_WIDTH 1
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_OFST 0
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_LBN 31
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_WIDTH 1
+/* The number of rows present in this response. */
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROW_COUNT_OFST 4
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROW_COUNT_LEN 4
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_OFST 8
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LEN 8
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_OFST 8
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_LEN 4
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_LBN 64
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_WIDTH 32
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_OFST 12
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_LEN 4
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_LBN 96
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_WIDTH 32
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MINNUM 0
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MAXNUM 30
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MAXNUM_MCDI2 126
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_OFST 8
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_LBN 0
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_WIDTH 6
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_OFST 8
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_LBN 6
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_WIDTH 1
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_OFST 8
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_LBN 7
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_WIDTH 1
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_OFST 8
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_LBN 8
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_WIDTH 24
+/* The time of the LTSSM transition. Times are reported as fractional
+ * microseconds since MC boot (wrapping at 2^32us). The fractional part is
+ * reported in picoseconds. 0 <= TIMESTAMP_PS < 1000000 timestamp in seconds =
+ * ((TIMESTAMP_US + TIMESTAMP_PS / 1000000) / 1000000)
+ */
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_US_OFST 12
+#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_US_LEN 4
+
+
+/***********************************/
+/* MC_CMD_TELEMETRY_ENABLE
+ * This command enables telemetry processing of packets, allowing a remote host
+ * to gather information and analytics passing on the card. Enabling telemetry
+ * will have a performance cost. Not supported on all hardware and datapath
+ * variants. As of writing, only supported on Medford2 running full-featured
+ * firmware variant.
+ */
+#define MC_CMD_TELEMETRY_ENABLE 0x138
+#undef MC_CMD_0x138_PRIVILEGE_CTG
+
+#define MC_CMD_0x138_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_TELEMETRY_ENABLE_IN msgrequest */
+#define MC_CMD_TELEMETRY_ENABLE_IN_LEN 4
+#define MC_CMD_TELEMETRY_ENABLE_IN_STATE_OFST 0
+#define MC_CMD_TELEMETRY_ENABLE_IN_STATE_LEN 4
+/* enum: Disables telemetry functionality, returns the card to default
+ * behaviour of the configured datapath variant.
+ */
+#define MC_CMD_TELEMETRY_ENABLE_IN_DISABLE 0x0
+/* enum: Enables telemetry functionality on the currently configured datapath
+ * variant if supported.
+ */
+#define MC_CMD_TELEMETRY_ENABLE_IN_ENABLE 0x1
+
+/* MC_CMD_TELEMETRY_ENABLE_OUT msgresponse */
+#define MC_CMD_TELEMETRY_ENABLE_OUT_LEN 0
+
+/* TELEMETRY_CONFIG structuredef */
+#define TELEMETRY_CONFIG_LEN 36
+/* Bitfields to identify the list of config parameters included in the command.
+ * A bit-value of 1 indicates that the relevant config parameter field is
+ * valid; 0 indicates invalid and the config parameter field must be ignored by
+ * firmware. Firmware may however apply some default values for certain
+ * parameters.
+ */
+#define TELEMETRY_CONFIG_FLAGS_OFST 0
+#define TELEMETRY_CONFIG_FLAGS_LEN 4
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_OFST 0
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_LBN 0
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_WIDTH 1
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_OFST 0
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_LBN 1
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_WIDTH 1
+#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_OFST 0
+#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_LBN 2
+#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_WIDTH 1
+#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_OFST 0
+#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_LBN 3
+#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_WIDTH 1
+#define TELEMETRY_CONFIG_RESERVED1_OFST 0
+#define TELEMETRY_CONFIG_RESERVED1_LBN 4
+#define TELEMETRY_CONFIG_RESERVED1_WIDTH 28
+#define TELEMETRY_CONFIG_FLAGS_LBN 0
+#define TELEMETRY_CONFIG_FLAGS_WIDTH 32
+/* Collector IPv4/IPv6 address to which latency measurements are forwarded from
+ * the adapter (as bytes in network order; set last 12 bytes to 0 for IPv4
+ * address).
+ */
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_OFST 4
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_LEN 16
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_LBN 32
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_WIDTH 128
+/* Collector Port number to which latency measurements are forwarded from the
+ * adapter (as bytes in network order).
+ */
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_OFST 20
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_LEN 2
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_LBN 160
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_WIDTH 16
+/* Unused - set to 0. */
+#define TELEMETRY_CONFIG_RESERVED2_OFST 22
+#define TELEMETRY_CONFIG_RESERVED2_LEN 2
+#define TELEMETRY_CONFIG_RESERVED2_LBN 176
+#define TELEMETRY_CONFIG_RESERVED2_WIDTH 16
+/* MAC address of the collector (as bytes in network order). */
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_OFST 24
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_LEN 6
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_LBN 192
+#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_WIDTH 48
+/* Maximum number of latency measurements to be made on a telemetry flow. */
+#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_OFST 30
+#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_LEN 2
+#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_LBN 240
+#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_WIDTH 16
+/* Maximum duration for which a telemetry flow is monitored (in millisecs). */
+#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_OFST 32
+#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_LEN 4
+#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_LBN 256
+#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_WIDTH 32
+
+
+/***********************************/
+/* MC_CMD_TELEMETRY_CONFIG
+ * This top-level command includes various sub-opcodes that are used to apply
+ * (and read-back) telemetry related configuration parameters on the NIC.
+ * Reference - SF-120569-SW Telemetry Firmware Design.
+ */
+#define MC_CMD_TELEMETRY_CONFIG 0x139
+#undef MC_CMD_0x139_PRIVILEGE_CTG
+
+#define MC_CMD_0x139_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_TELEMETRY_CONFIG_IN msgrequest */
+#define MC_CMD_TELEMETRY_CONFIG_IN_LEN 4
+/* Telemetry configuration sub-operation code */
+#define MC_CMD_TELEMETRY_CONFIG_IN_OP_OFST 0
+#define MC_CMD_TELEMETRY_CONFIG_IN_OP_LEN 4
+/* enum: Configure parameters for telemetry measurements. */
+#define MC_CMD_TELEMETRY_CONFIG_OP_SET 0x1
+/* enum: Read current values of parameters for telemetry measurements. */
+#define MC_CMD_TELEMETRY_CONFIG_OP_GET 0x2
+
+/* MC_CMD_TELEMETRY_CONFIG_IN_SET msgrequest: This command configures the
+ * parameters necessary for tcp-latency measurements. The adapter adds a filter
+ * for every new tcp flow seen in both tx and rx directions and tracks the
+ * telemetry measurements related to the flow in a tracking table. Entries in
+ * the tracking table live as long as N measurements are made on the flow or
+ * the flow has been in the tracking table for the maximum configured duration.
+ * Telemetry measurements in this command refer to tcp-latency measurements for
+ * data-to-ack latency as well as data-to-data latency. All telemetry
+ * measurements are bundled into a UDP packet and forwarded to a collector
+ * whose IP address is configured using this command.
+ */
+#define MC_CMD_TELEMETRY_CONFIG_IN_SET_LEN 40
+/* Telemetry configuration sub-operation code. Must be set to
+ * MC_CMD_TELEMETRY_CONFIG_OP_SET.
+ */
+#define MC_CMD_TELEMETRY_CONFIG_IN_SET_OP_OFST 0
+#define MC_CMD_TELEMETRY_CONFIG_IN_SET_OP_LEN 4
+/* struct of type TELEMETRY_CONFIG. */
+#define MC_CMD_TELEMETRY_CONFIG_IN_SET_PARAMETERS_OFST 4
+#define MC_CMD_TELEMETRY_CONFIG_IN_SET_PARAMETERS_LEN 36
+
+/* MC_CMD_TELEMETRY_CONFIG_OUT_SET msgresponse */
+#define MC_CMD_TELEMETRY_CONFIG_OUT_SET_LEN 0
+
+/* MC_CMD_TELEMETRY_CONFIG_IN_GET msgrequest: This command reads out the
+ * current values of config parameters necessary for tcp-latency measurements.
+ * See MC_CMD_TELEMETRY_SET_CONFIG for more information about the configuration
+ * parameters.
+ */
+#define MC_CMD_TELEMETRY_CONFIG_IN_GET_LEN 4
+/* Telemetry configuration sub-operation code. Must be set to
+ * MC_CMD_TELEMETRY_CONFIG_OP_GET.
+ */
+#define MC_CMD_TELEMETRY_CONFIG_IN_GET_OP_OFST 0
+#define MC_CMD_TELEMETRY_CONFIG_IN_GET_OP_LEN 4
+
+/* MC_CMD_TELEMETRY_CONFIG_OUT_GET msgresponse */
+#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_LEN 36
+/* struct of type TELEMETRY_CONFIG. */
+#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_PARAMETERS_OFST 0
+#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_PARAMETERS_LEN 36
+
+
/***********************************/
/* MC_CMD_GET_RX_PREFIX_ID
* This command is part of the mechanism for configuring the format of the RX
@@ -23832,6 +27337,427 @@
#define MC_CMD_GET_NCSI_INFO_STATISTICS_OUT_AENS_SENT_OFST 24
#define MC_CMD_GET_NCSI_INFO_STATISTICS_OUT_AENS_SENT_LEN 4

+
+/***********************************/
+/* MC_CMD_FIRMWARE_SET_LOCKDOWN
+ * System lockdown, when enabled firmware updates are blocked.
+ */
+#define MC_CMD_FIRMWARE_SET_LOCKDOWN 0x16f
+#undef MC_CMD_0x16f_PRIVILEGE_CTG
+
+#define MC_CMD_0x16f_PRIVILEGE_CTG SRIOV_CTG_ADMIN
+
+/* MC_CMD_FIRMWARE_SET_LOCKDOWN_IN msgrequest: This MCDI command is to enable
+ * only because lockdown can only be disabled by a PMCI command or a cold reset
+ * of the system.
+ */
+#define MC_CMD_FIRMWARE_SET_LOCKDOWN_IN_LEN 0
+
+/* MC_CMD_FIRMWARE_SET_LOCKDOWN_OUT msgresponse */
+#define MC_CMD_FIRMWARE_SET_LOCKDOWN_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_GET_TEST_FEATURES
+ * This command returns device details knowledge of which may be required by
+ * test infrastructure. Although safe, it is not intended to be used by
+ * production drivers, and the structure returned intentionally has no public
+ * documentation.
+ */
+#define MC_CMD_GET_TEST_FEATURES 0x1ac
+#undef MC_CMD_0x1ac_PRIVILEGE_CTG
+
+#define MC_CMD_0x1ac_PRIVILEGE_CTG SRIOV_CTG_GENERAL
+
+/* MC_CMD_GET_TEST_FEATURES_IN msgrequest: Request test features. */
+#define MC_CMD_GET_TEST_FEATURES_IN_LEN 0
+
+/* MC_CMD_GET_TEST_FEATURE_OUT msgresponse */
+#define MC_CMD_GET_TEST_FEATURE_OUT_LENMIN 4
+#define MC_CMD_GET_TEST_FEATURE_OUT_LENMAX 252
+#define MC_CMD_GET_TEST_FEATURE_OUT_LENMAX_MCDI2 1020
+#define MC_CMD_GET_TEST_FEATURE_OUT_LEN(num) (0+4*(num))
+#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_NUM(len) (((len)-0)/4)
+/* Test-specific NIC information. Production drivers must treat this as opaque.
+ * The layout is defined in the private TEST_FEATURES_LAYOUT structure.
+ */
+#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_OFST 0
+#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_LEN 4
+#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MINNUM 1
+#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MAXNUM 63
+#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MAXNUM_MCDI2 255
+
+
+/***********************************/
+/* MC_CMD_FPGA
+ * A command to perform various fpga-related operations on platforms that
+ * include FPGAs. Note that some platforms may only support a subset of these
+ * operations.
+ */
+#define MC_CMD_FPGA 0x1bf
+#undef MC_CMD_0x1bf_PRIVILEGE_CTG
+
+#define MC_CMD_0x1bf_PRIVILEGE_CTG SRIOV_CTG_GENERAL
+
+/* MC_CMD_FPGA_IN msgrequest */
+#define MC_CMD_FPGA_IN_LEN 4
+/* Sub-command code */
+#define MC_CMD_FPGA_IN_OP_OFST 0
+#define MC_CMD_FPGA_IN_OP_LEN 4
+/* enum: Get the FPGA version string. */
+#define MC_CMD_FPGA_IN_OP_GET_VERSION 0x0
+/* enum: Read bitmask of features supported in the FPGA image. */
+#define MC_CMD_FPGA_IN_OP_GET_CAPABILITIES 0x1
+/* enum: Perform a FPGA reset. */
+#define MC_CMD_FPGA_IN_OP_RESET 0x2
+/* enum: Set active flash device. */
+#define MC_CMD_FPGA_IN_OP_SELECT_FLASH 0x3
+/* enum: Get active flash device. */
+#define MC_CMD_FPGA_IN_OP_GET_ACTIVE_FLASH 0x4
+/* enum: Configure internal link i.e. the FPGA port facing the ASIC. */
+#define MC_CMD_FPGA_IN_OP_SET_INTERNAL_LINK 0x5
+/* enum: Read internal link configuration. */
+#define MC_CMD_FPGA_IN_OP_GET_INTERNAL_LINK 0x6
+/* enum: Get MAC statistics of FPGA external port. */
+#define MC_CMD_FPGA_IN_OP_GET_MAC_STATS 0x7
+/* enum: Set configuration on internal FPGA MAC. */
+#define MC_CMD_FPGA_IN_OP_SET_INTERNAL_MAC 0x8
+
+/* MC_CMD_FPGA_OP_GET_VERSION_IN msgrequest: Get the FPGA version string. A
+ * free-format string is returned in response to this command. Any checks on
+ * supported FPGA operations are based on the response to
+ * MC_CMD_FPGA_OP_GET_CAPABILITIES.
+ */
+#define MC_CMD_FPGA_OP_GET_VERSION_IN_LEN 4
+/* Sub-command code. Must be OP_GET_VERSION */
+#define MC_CMD_FPGA_OP_GET_VERSION_IN_OP_OFST 0
+#define MC_CMD_FPGA_OP_GET_VERSION_IN_OP_LEN 4
+
+/* MC_CMD_FPGA_OP_GET_VERSION_OUT msgresponse: Returns the version string. */
+#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMIN 0
+#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMAX 252
+#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMAX_MCDI2 1020
+#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LEN(num) (0+1*(num))
+#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_NUM(len) (((len)-0)/1)
+/* Null-terminated string containing version information. */
+#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_OFST 0
+#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_LEN 1
+#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MINNUM 0
+#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MAXNUM 252
+#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MAXNUM_MCDI2 1020
+
+/* MC_CMD_FPGA_OP_GET_CAPABILITIES_IN msgrequest: Read bitmask of features
+ * supported in the FPGA image.
+ */
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_LEN 4
+/* Sub-command code. Must be OP_GET_CAPABILITIES */
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_OP_OFST 0
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_OP_LEN 4
+
+/* MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT msgresponse: Returns the version string.
+ */
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_LEN 4
+/* Bit-mask of supported features. */
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_CAPABILITIES_OFST 0
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_CAPABILITIES_LEN 4
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_OFST 0
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_LBN 0
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_WIDTH 1
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_OFST 0
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_LBN 1
+#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_WIDTH 1
+
+/* MC_CMD_FPGA_OP_RESET_IN msgrequest: Perform a FPGA reset operation where
+ * supported.
+ */
+#define MC_CMD_FPGA_OP_RESET_IN_LEN 4
+/* Sub-command code. Must be OP_RESET */
+#define MC_CMD_FPGA_OP_RESET_IN_OP_OFST 0
+#define MC_CMD_FPGA_OP_RESET_IN_OP_LEN 4
+
+/* MC_CMD_FPGA_OP_RESET_OUT msgresponse */
+#define MC_CMD_FPGA_OP_RESET_OUT_LEN 0
+
+/* MC_CMD_FPGA_OP_SELECT_FLASH_IN msgrequest: Set active FPGA flash device.
+ * Returns EINVAL if selected flash index does not exist on the platform under
+ * test.
+ */
+#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_LEN 8
+/* Sub-command code. Must be OP_SELECT_FLASH */
+#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_OP_OFST 0
+#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_OP_LEN 4
+/* Flash device identifier. */
+#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_FLASH_ID_OFST 4
+#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_FLASH_ID_LEN 4
+/* Enum values, see field(s): */
+/* MC_CMD_FPGA_FLASH_INDEX */
+
+/* MC_CMD_FPGA_OP_SELECT_FLASH_OUT msgresponse */
+#define MC_CMD_FPGA_OP_SELECT_FLASH_OUT_LEN 0
+
+/* MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN msgrequest: Get active FPGA flash device.
+ */
+#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_LEN 4
+/* Sub-command code. Must be OP_GET_ACTIVE_FLASH */
+#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_OP_OFST 0
+#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_OP_LEN 4
+
+/* MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT msgresponse: Returns flash identifier
+ * for current active flash.
+ */
+#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_LEN 4
+/* Flash device identifier. */
+#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_FLASH_ID_OFST 0
+#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_FLASH_ID_LEN 4
+/* Enum values, see field(s): */
+/* MC_CMD_FPGA_FLASH_INDEX */
+
+/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN msgrequest: Configure FPGA internal
+ * port, facing the ASIC
+ */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LEN 12
+/* Sub-command code. Must be OP_SET_INTERNAL_LINK */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_OP_OFST 0
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_OP_LEN 4
+/* Flags */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLAGS_OFST 4
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLAGS_LEN 4
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_OFST 4
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_LBN 0
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_WIDTH 2
+/* enum: Unmodified, same as last state set by firmware */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_AUTO 0x0
+/* enum: Configure link-up */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_UP 0x1
+/* enum: Configure link-down */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_DOWN 0x2
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_OFST 4
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_LBN 2
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_WIDTH 1
+/* Link speed to be applied on FPGA internal port MAC. */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_SPEED_OFST 8
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_SPEED_LEN 4
+
+/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_OUT msgresponse */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_OUT_LEN 0
+
+/* MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN msgrequest: Read FPGA internal port
+ * configuration and status
+ */
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_LEN 4
+/* Sub-command code. Must be OP_GET_INTERNAL_LINK */
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_OP_OFST 0
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_OP_LEN 4
+
+/* MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT msgresponse: Response format for read
+ * FPGA internal port configuration and status
+ */
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LEN 8
+/* Flags */
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_FLAGS_OFST 0
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_FLAGS_LEN 4
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_OFST 0
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_LBN 0
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_WIDTH 2
+/* Enum values, see field(s): */
+/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN/FLAGS */
+/* Link speed set on FPGA internal port MAC. */
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_SPEED_OFST 4
+#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_SPEED_LEN 4
+
+/* MC_CMD_FPGA_OP_GET_MAC_STATS_IN msgrequest: Get FPGA external port MAC
+ * statistics.
+ */
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_LEN 4
+/* Sub-command code. Must be OP_GET_MAC_STATS. */
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_OP_OFST 0
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_OP_LEN 4
+
+/* MC_CMD_FPGA_OP_GET_MAC_STATS_OUT msgresponse */
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMIN 4
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMAX 252
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMAX_MCDI2 1020
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LEN(num) (4+8*(num))
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_NUM(len) (((len)-4)/8)
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_NUM_STATS_OFST 0
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_NUM_STATS_LEN 4
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_OFST 4
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LEN 8
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_OFST 4
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_LEN 4
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_LBN 32
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_WIDTH 32
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_OFST 8
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_LEN 4
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_LBN 64
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_WIDTH 32
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MINNUM 0
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MAXNUM 31
+#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MAXNUM_MCDI2 127
+#define MC_CMD_FPGA_MAC_TX_TOTAL_PACKETS 0x0 /* enum */
+#define MC_CMD_FPGA_MAC_TX_TOTAL_BYTES 0x1 /* enum */
+#define MC_CMD_FPGA_MAC_TX_TOTAL_GOOD_PACKETS 0x2 /* enum */
+#define MC_CMD_FPGA_MAC_TX_TOTAL_GOOD_BYTES 0x3 /* enum */
+#define MC_CMD_FPGA_MAC_TX_BAD_FCS 0x4 /* enum */
+#define MC_CMD_FPGA_MAC_TX_PAUSE 0x5 /* enum */
+#define MC_CMD_FPGA_MAC_TX_USER_PAUSE 0x6 /* enum */
+#define MC_CMD_FPGA_MAC_RX_TOTAL_PACKETS 0x7 /* enum */
+#define MC_CMD_FPGA_MAC_RX_TOTAL_BYTES 0x8 /* enum */
+#define MC_CMD_FPGA_MAC_RX_TOTAL_GOOD_PACKETS 0x9 /* enum */
+#define MC_CMD_FPGA_MAC_RX_TOTAL_GOOD_BYTES 0xa /* enum */
+#define MC_CMD_FPGA_MAC_RX_BAD_FCS 0xb /* enum */
+#define MC_CMD_FPGA_MAC_RX_PAUSE 0xc /* enum */
+#define MC_CMD_FPGA_MAC_RX_USER_PAUSE 0xd /* enum */
+#define MC_CMD_FPGA_MAC_RX_UNDERSIZE 0xe /* enum */
+#define MC_CMD_FPGA_MAC_RX_OVERSIZE 0xf /* enum */
+#define MC_CMD_FPGA_MAC_RX_FRAMING_ERR 0x10 /* enum */
+#define MC_CMD_FPGA_MAC_FEC_UNCORRECTED_ERRORS 0x11 /* enum */
+#define MC_CMD_FPGA_MAC_FEC_CORRECTED_ERRORS 0x12 /* enum */
+
+/* MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN msgrequest: Configures the internal port
+ * MAC on the FPGA.
+ */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_LEN 20
+/* Sub-command code. Must be OP_SET_INTERNAL_MAC. */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_OP_OFST 0
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_OP_LEN 4
+/* Select which parameters to configure. */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CONTROL_OFST 4
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CONTROL_LEN 4
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_OFST 4
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_LBN 0
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_WIDTH 1
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_OFST 4
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_LBN 1
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_WIDTH 1
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_OFST 4
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_LBN 2
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_WIDTH 1
+/* The MTU to be programmed into the MAC. */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_MTU_OFST 8
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_MTU_LEN 4
+/* Drain Tx FIFO */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_DRAIN_OFST 12
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_DRAIN_LEN 4
+/* flow control configuration. See MC_CMD_SET_MAC/MC_CMD_SET_MAC_IN/FCNTL. */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_FCNTL_OFST 16
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_FCNTL_LEN 4
+
+/* MC_CMD_FPGA_OP_SET_INTERNAL_MAC_OUT msgresponse */
+#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE
+ * This command is expected to be used on a U25 board with an MAE in the FPGA.
+ * It does not modify the operational state of the NIC. The modes are described
+ * in XN-200039-TC - U25 OVS packet formats.
+ */
+#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE 0x1c0
+#undef MC_CMD_0x1c0_PRIVILEGE_CTG
+
+#define MC_CMD_0x1c0_PRIVILEGE_CTG SRIOV_CTG_GENERAL
+
+/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_IN msgrequest */
+#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_IN_LEN 0
+
+/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT msgresponse */
+#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_LEN 4
+/* The current link mode */
+#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_MODE_OFST 0
+#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_MODE_LEN 4
+/* Enum values, see field(s): */
+/* MC_CMD_EXTERNAL_MAE_LINK_MODE */
+
+
+/***********************************/
+/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE
+ * This command is expected to be used on a U25 board with an MAE in the FPGA.
+ * The modes are described in XN-200039-TC - U25 OVS packet formats. This
+ * command will set the link between the FPGA and the X2 to the specified new
+ * mode. It will first enter bootstrap mode, make sure there are no packets in
+ * flight and then enter the requested mode. In order to make sure there are no
+ * packets in flight, it will flush the X2 TX path, the FPGA RX path from the
+ * X2, the FPGA TX path to the X2 and the X2 RX path. The driver is responsible
+ * for making sure there are no TX or RX descriptors posted on any TXQ or RXQ
+ * associated with the affected port before invoking this command. This command
+ * is run implicitly with MODE set to LEGACY when MC_CMD_DRV_ATTACH is
+ * executed.
+ */
+#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE 0x1c1
+#undef MC_CMD_0x1c1_PRIVILEGE_CTG
+
+#define MC_CMD_0x1c1_PRIVILEGE_CTG SRIOV_CTG_GENERAL
+
+/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN msgrequest */
+#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_LEN 4
+/* The new link mode. */
+#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_MODE_OFST 0
+#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_MODE_LEN 4
+/* Enum values, see field(s): */
+/* MC_CMD_EXTERNAL_MAE_LINK_MODE */
+
+/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_OUT msgresponse */
+#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_OUT_LEN 0
+
+
+/***********************************/
+/* MC_CMD_GET_BUFTBL_STATS
+ * Currently EF10 only. Read usage and limits for Buffer Table
+ */
+#define MC_CMD_GET_BUFTBL_STATS 0x6a
+#undef MC_CMD_0x6a_PRIVILEGE_CTG
+
+#define MC_CMD_0x6a_PRIVILEGE_CTG SRIOV_CTG_GENERAL
+
+/* MC_CMD_GET_BUFTBL_STATS_IN msgrequest */
+#define MC_CMD_GET_BUFTBL_STATS_IN_LEN 0
+
+/* MC_CMD_GET_BUFTBL_STATS_OUT msgresponse */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_LEN 40
+/* number of buffer table entries per set */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_SET_OFST 0
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_SET_LEN 4
+/* number of buffer table entries per cluster */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_CLUSTER_OFST 4
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_CLUSTER_LEN 4
+/* Maximum size buffer table can grow to, in clusters. On EF10, this can
+ * potentially vary depending on the size of the Descriptor Cache.
+ */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MAX_CLUSTERS_OFST 8
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MAX_CLUSTERS_LEN 4
+/* High water mark for number of buffer table clusters which have been
+ * allocated.
+ */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HIGH_WATER_CLUSTERS_OFST 12
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HIGH_WATER_CLUSTERS_LEN 4
+/* Number of free buffer table clusters on the free cluster list. */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_CLUSTERS_OFST 16
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_CLUSTERS_LEN 4
+/* Number of free buffer table sets on the free set list. */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_SETS_OFST 20
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_SETS_LEN 4
+/* Number of chunks of fully-used clusters allocated to the MC for EVQ, RXQ and
+ * TXQs.
+ */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_FULL_CLUSTERS_OFST 24
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_FULL_CLUSTERS_LEN 4
+/* Number of chunks in partially-used clusters allocated to the MC for EVQ, RXQ
+ * and TXQs.
+ */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_PART_CLUSTERS_OFST 28
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_PART_CLUSTERS_LEN 4
+/* Number of buffer table sets (chunks) allocated to the host via
+ * MC_CMD_ALLOC_BUFTBL_CHUNK.
+ */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HOST_SETS_OFST 32
+#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HOST_SETS_LEN 4
+/* Maximum number of VIs per NIC. On EF10 this is the current value as used to
+ * size the Descriptor Cache in hardware.
+ */
+#define MC_CMD_GET_BUFTBL_STATS_OUT_VI_MAX_OFST 36
+#define MC_CMD_GET_BUFTBL_STATS_OUT_VI_MAX_LEN 4
+
/* CLIENT_HANDLE structuredef: A client is an abstract entity that can make
* requests of the device and that can own resources managed by the device.
* Examples of clients include PCIe functions and dynamic clients. A client
@@ -23899,8 +27825,8 @@

/* SCHED_CREDIT_CHECK_RESULT structuredef */
#define SCHED_CREDIT_CHECK_RESULT_LEN 16
-/* The instance of the scheduler. Refer to XN-200389-AW for the location of
- * these schedulers in the hardware.
+/* The instance of the scheduler. Refer to XN-200389-AW (snic/hnic) and
+ * XN-200425-TC (cdx) for the location of these schedulers in the hardware.
*/
#define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_OFST 0
#define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_LEN 1
@@ -23914,6 +27840,16 @@
#define SCHED_CREDIT_CHECK_RESULT_DMAC_H2C 0x7 /* enum */
#define SCHED_CREDIT_CHECK_RESULT_HUB_NET_B 0x8 /* enum */
#define SCHED_CREDIT_CHECK_RESULT_HUB_NET_REPLAY 0x9 /* enum */
+#define SCHED_CREDIT_CHECK_RESULT_ADAPTER_C2H_C 0xa /* enum */
+#define SCHED_CREDIT_CHECK_RESULT_A2_H2C_C 0xb /* enum */
+#define SCHED_CREDIT_CHECK_RESULT_A3_SOFT_ADAPTOR_C 0xc /* enum */
+#define SCHED_CREDIT_CHECK_RESULT_A4_DPU_WRITE_C 0xd /* enum */
+#define SCHED_CREDIT_CHECK_RESULT_JRC_RRU 0xe /* enum */
+#define SCHED_CREDIT_CHECK_RESULT_CDM_SINK 0xf /* enum */
+#define SCHED_CREDIT_CHECK_RESULT_PCIE_SINK 0x10 /* enum */
+#define SCHED_CREDIT_CHECK_RESULT_UPORT_SINK 0x11 /* enum */
+#define SCHED_CREDIT_CHECK_RESULT_PSX_SINK 0x12 /* enum */
+#define SCHED_CREDIT_CHECK_RESULT_A5_DPU_READ_C 0x13 /* enum */
#define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_LBN 0
#define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_WIDTH 8
/* The type of node that this result refers to. */
@@ -23923,6 +27859,10 @@
#define SCHED_CREDIT_CHECK_RESULT_DEST 0x0
/* enum: Source node */
#define SCHED_CREDIT_CHECK_RESULT_SOURCE 0x1
+/* enum: Destination node credit type 1 (new to the Keystone schedulers, see
+ * SF-120268-TC)
+ */
+#define SCHED_CREDIT_CHECK_RESULT_DEST_CREDIT1 0x2
#define SCHED_CREDIT_CHECK_RESULT_NODE_TYPE_LBN 8
#define SCHED_CREDIT_CHECK_RESULT_NODE_TYPE_WIDTH 8
/* Level of node in scheduler hierarchy (level 0 is the bottom of the
@@ -26076,6 +30016,26 @@
#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MINNUM 0
#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MAXNUM 4
#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MAXNUM_MCDI2 19
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_OFST 4
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LEN 8
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_OFST 4
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_LEN 4
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_LBN 32
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_WIDTH 32
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_OFST 8
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_LEN 4
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_LBN 64
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_WIDTH 32
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_PF_OFST 4
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_PF_LEN 2
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_VF_OFST 6
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_VF_LEN 2
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_INTF_OFST 8
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_INTF_LEN 4
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_PERSONALITY_OFST 12
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_PERSONALITY_LEN 4
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_LABEL_OFST 16
+#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_LABEL_LEN 40


/***********************************/
@@ -27350,7 +31310,7 @@
/* MAE_MPORT_SELECTOR structuredef: MPORTS are identified by an opaque unsigned
* integer value (mport_id) that is guaranteed to be representable within
* 32-bits or within any NIC interface field that needs store the value
- * (whichever is narrowers). This selector structure provides a stable way to
+ * (whichever is narrower). This selector structure provides a stable way to
* refer to m-ports.
*/
#define MAE_MPORT_SELECTOR_LEN 4
@@ -27425,10 +31385,22 @@
#define MAE_MPORT_SELECTOR_FLAT_WIDTH 32

/* MAE_LINK_ENDPOINT_SELECTOR structuredef: Structure that identifies a real or
- * virtual network port by MAE port and link end
+ * virtual network port by MAE port and link end. Intended to be used by
+ * network port MCDI commands. Setting FLAT to MAE_LINK_ENDPOINT_COMPAT is
+ * equivalent to using the previous version of the command. Not all possible
+ * combinations of MPORT_END and MPORT_SELECTOR in MAE_LINK_ENDPOINT_SELECTOR
+ * will work in all circumstances. 1. Some will always work (e.g. a VF can
+ * always address its logical MAC using MPORT_SELECTOR=ASSIGNED,LINK_END=VNIC),
+ * 2. Some are not meaningful and will always fail with EINVAL (e.g. attempting
+ * to address the VNIC end of a link to a physical port), 3. Some are
+ * meaningful but require the MCDI client to have the required permission and
+ * fail with EPERM otherwise (e.g. trying to set the MAC on a VF the caller
+ * cannot administer), and 4. Some could be implementation-specific and fail
+ * with ENOTSUP if not available (no examples exist right now). See
+ * SF-123581-TC section 4.3 for more details.
*/
#define MAE_LINK_ENDPOINT_SELECTOR_LEN 8
-/* The MAE MPORT of interest */
+/* Identifier for the MAE MPORT of interest */
#define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_OFST 0
#define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_LEN 4
#define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_LBN 0
@@ -27829,6 +31801,8 @@
#define MC_CMD_MAE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM_MCDI2 253
/* enum: A counter ID that is guaranteed never to represent a real counter */
#define MC_CMD_MAE_COUNTER_ALLOC_OUT_COUNTER_ID_NULL 0xffffffff
+/* Other enum values, see field(s): */
+/* MAE_COUNTER_ID */


/***********************************/
@@ -28266,6 +32240,24 @@
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_OFST 0
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_LBN 14
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_LBN 15
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_LBN 16
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_LBN 18
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_LBN 19
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_LBN 20
+#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_WIDTH 1
/* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_VLAN0_TCI_BE_OFST 4
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_VLAN0_TCI_BE_LEN 2
@@ -28291,19 +32283,23 @@
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DELIVER_OFST 20
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DELIVER_LEN 4
/* Allows an action set to trigger several counter updates. Set to
- * COUNTER_LIST_ID_NULL to request no counter action.
+ * MAE_COUNTER_ID_NULL to request no counter action.
*/
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_LIST_ID_OFST 24
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_LIST_ID_LEN 4
+/* Enum values, see field(s): */
+/* MAE_COUNTER_ID */
/* If a driver only wished to update one counter within this action set, then
* it can supply a COUNTER_ID instead of allocating a single-element counter
* list. The ID must have been allocated with COUNTER_TYPE=AR. This field
- * should be set to COUNTER_ID_NULL if this behaviour is not required. It is
- * not valid to supply a non-NULL value for both COUNTER_LIST_ID and
+ * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
+ * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
* COUNTER_ID.
*/
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_ID_OFST 28
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_ID_LEN 4
+/* Enum values, see field(s): */
+/* MAE_COUNTER_ID */
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_MARK_VALUE_OFST 32
#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_MARK_VALUE_LEN 4
/* Set to MAC_ID_NULL to request no source MAC replacement. */
@@ -28347,6 +32343,24 @@
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_OFST 0
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_LBN 14
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_LBN 15
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_LBN 16
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_LBN 18
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_LBN 19
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_LBN 20
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_WIDTH 1
/* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_VLAN0_TCI_BE_OFST 4
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_VLAN0_TCI_BE_LEN 2
@@ -28372,19 +32386,23 @@
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DELIVER_OFST 20
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DELIVER_LEN 4
/* Allows an action set to trigger several counter updates. Set to
- * COUNTER_LIST_ID_NULL to request no counter action.
+ * MAE_COUNTER_ID_NULL to request no counter action.
*/
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_LIST_ID_OFST 24
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_LIST_ID_LEN 4
+/* Enum values, see field(s): */
+/* MAE_COUNTER_ID */
/* If a driver only wished to update one counter within this action set, then
* it can supply a COUNTER_ID instead of allocating a single-element counter
* list. The ID must have been allocated with COUNTER_TYPE=AR. This field
- * should be set to COUNTER_ID_NULL if this behaviour is not required. It is
- * not valid to supply a non-NULL value for both COUNTER_LIST_ID and
+ * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
+ * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
* COUNTER_ID.
*/
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_ID_OFST 28
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_ID_LEN 4
+/* Enum values, see field(s): */
+/* MAE_COUNTER_ID */
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_MARK_VALUE_OFST 32
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_MARK_VALUE_LEN 4
/* Set to MAC_ID_NULL to request no source MAC replacement. */
@@ -28437,6 +32455,172 @@
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_ECN_ECT_1_TO_CE_LBN 6
#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_ECN_ECT_1_TO_CE_WIDTH 1

+/* MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN msgrequest: Only supported if
+ * MAE_ACTION_SET_ALLOC_V3_SUPPORTED is advertised in
+ * MC_CMD_GET_CAPABILITIES_V10_OUT.
+ */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LEN 53
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAGS_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAGS_LEN 4
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_LBN 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_WIDTH 2
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_LBN 4
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_WIDTH 2
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_LBN 8
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_LBN 9
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_LBN 10
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_LBN 11
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_LBN 12
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_LBN 13
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_LBN 14
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_LBN 15
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_LBN 16
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_LBN 18
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_LBN 19
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_OFST 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_LBN 20
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_WIDTH 1
+/* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_TCI_BE_OFST 4
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_TCI_BE_LEN 2
+/* If VLAN_PUSH >= 1, TPID value to be inserted as outermost VLAN. */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_PROTO_BE_OFST 6
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_PROTO_BE_LEN 2
+/* If VLAN_PUSH == 2, inner TCI value to be inserted. */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_TCI_BE_OFST 8
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_TCI_BE_LEN 2
+/* If VLAN_PUSH == 2, inner TPID value to be inserted. */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_PROTO_BE_OFST 10
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_PROTO_BE_LEN 2
+/* Reserved. Ignored by firmware. Should be set to zero or 0xffffffff. */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RSVD_OFST 12
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RSVD_LEN 4
+/* Set to ENCAP_HEADER_ID_NULL to request no encap action */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ENCAP_HEADER_ID_OFST 16
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ENCAP_HEADER_ID_LEN 4
+/* An m-port selector identifying the m-port that the modified packet should be
+ * delivered to. Set to MPORT_SELECTOR_NULL to request no delivery of the
+ * packet.
+ */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DELIVER_OFST 20
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DELIVER_LEN 4
+/* Allows an action set to trigger several counter updates. Set to
+ * MAE_COUNTER_ID_NULL to request no counter action.
+ */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_LIST_ID_OFST 24
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_LIST_ID_LEN 4
+/* Enum values, see field(s): */
+/* MAE_COUNTER_ID */
+/* If a driver only wished to update one counter within this action set, then
+ * it can supply a COUNTER_ID instead of allocating a single-element counter
+ * list. The ID must have been allocated with COUNTER_TYPE=AR. This field
+ * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
+ * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
+ * COUNTER_ID.
+ */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_ID_OFST 28
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_ID_LEN 4
+/* Enum values, see field(s): */
+/* MAE_COUNTER_ID */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_VALUE_OFST 32
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_VALUE_LEN 4
+/* Set to MAC_ID_NULL to request no source MAC replacement. */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SRC_MAC_ID_OFST 36
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SRC_MAC_ID_LEN 4
+/* Set to MAC_ID_NULL to request no destination MAC replacement. */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DST_MAC_ID_OFST 40
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DST_MAC_ID_LEN 4
+/* Source m-port ID to be reported for DO_SET_SRC_MPORT action. */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_REPORTED_SRC_MPORT_OFST 44
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_REPORTED_SRC_MPORT_LEN 4
+/* Actions for modifying the Differentiated Services Code-Point (DSCP) bits
+ * within IPv4 and IPv6 headers.
+ */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_CONTROL_OFST 48
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_CONTROL_LEN 2
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_OFST 48
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_LBN 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_OFST 48
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_LBN 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_OFST 48
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_LBN 2
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_OFST 48
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_LBN 3
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_WIDTH 6
+/* Actions for modifying the Explicit Congestion Notification (ECN) bits within
+ * IPv4 and IPv6 headers.
+ */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_CONTROL_OFST 50
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_CONTROL_LEN 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_OFST 50
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_LBN 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_OFST 50
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_LBN 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_OFST 50
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_LBN 2
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_OFST 50
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_LBN 3
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_WIDTH 2
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_OFST 50
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_LBN 5
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_OFST 50
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_LBN 6
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_WIDTH 1
+/* Actions for overwriting CH_ROUTE subfields. */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OVERWRITE_OFST 51
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OVERWRITE_LEN 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_OFST 51
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_LBN 0
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_OFST 51
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_LBN 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_OFST 51
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_LBN 2
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_WIDTH 1
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_OFST 51
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_LBN 3
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_WIDTH 1
+/* Override outgoing CH_VC to network port for DO_SET_NET_CHAN action. Cannot
+ * be used in conjunction with DO_SET_SRC_MPORT action.
+ */
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_NET_CHAN_OFST 52
+#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_NET_CHAN_LEN 1
+
/* MC_CMD_MAE_ACTION_SET_ALLOC_OUT msgresponse */
#define MC_CMD_MAE_ACTION_SET_ALLOC_OUT_LEN 4
/* The MSB of the AS_ID is guaranteed to be clear if the ID is not
diff --git a/drivers/net/ethernet/sfc/mcdi_vdpa.c b/drivers/net/ethernet/sfc/mcdi_vdpa.c
index b9668545ca01..f9ee61b84320 100644
--- a/drivers/net/ethernet/sfc/mcdi_vdpa.c
+++ b/drivers/net/ethernet/sfc/mcdi_vdpa.c
@@ -14,14 +14,6 @@
#include "mcdi_vdpa.h"
#include "mcdi_pcol.h"

-/* The value of target_vf in virtio MC commands like
- * virtqueue create, delete and get doorbell offset should
- * contain the VF index when the calling function is a PF
- * and VF_NULL (0xFFFF) otherwise. As the vDPA driver invokes
- * MC commands in context of the VF, it uses VF_NULL.
- */
-#define MC_CMD_VIRTIO_TARGET_VF_NULL 0xFFFF
-
struct efx_vring_ctx *efx_vdpa_vring_init(struct efx_nic *efx, u32 vi,
enum ef100_vdpa_vq_type vring_type)
{
@@ -47,7 +39,7 @@ struct efx_vring_ctx *efx_vdpa_vring_init(struct efx_nic *efx, u32 vi,
}

vring_ctx->efx = efx;
- vring_ctx->vf_index = MC_CMD_VIRTIO_TARGET_VF_NULL;
+ vring_ctx->vf_index = MC_CMD_VIRTIO_INIT_QUEUE_REQ_VF_NULL;
vring_ctx->vi_index = vi;
vring_ctx->mcdi_vring_type = queue_cmd;
return vring_ctx;
--
2.30.1


2023-03-07 11:39:42

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 04/14] sfc: evaluate vdpa support based on FW capability CLIENT_CMD_VF_PROXY

Add and update vdpa_supported field to struct efx_nic to true if
running Firmware supports CLIENT_CMD_VF_PROXY capability. This is
required to ensure DMA isolation between MCDI command buffer and guest
buffers.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/ef100_netdev.c | 26 +++++++++++++++---
drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++----------------
drivers/net/ethernet/sfc/ef100_nic.h | 6 +++--
drivers/net/ethernet/sfc/ef100_vdpa.h | 5 ++--
4 files changed, 41 insertions(+), 31 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c
index d916877b5a9a..5d93e870d9b7 100644
--- a/drivers/net/ethernet/sfc/ef100_netdev.c
+++ b/drivers/net/ethernet/sfc/ef100_netdev.c
@@ -355,6 +355,28 @@ void ef100_remove_netdev(struct efx_probe_data *probe_data)
efx->state = STATE_PROBED;
}

+static void efx_ef100_update_tso_features(struct efx_nic *efx)
+{
+ struct ef100_nic_data *nic_data = efx->nic_data;
+ struct net_device *net_dev = efx->net_dev;
+ netdev_features_t tso;
+
+ if (!efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3))
+ return;
+
+ tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
+ NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
+ NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
+
+ net_dev->features |= tso;
+ net_dev->hw_features |= tso;
+ net_dev->hw_enc_features |= tso;
+ /* EF100 HW can only offload outer checksums if they are UDP,
+ * so for GRE_CSUM we have to use GSO_PARTIAL.
+ */
+ net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
+}
+
int ef100_probe_netdev(struct efx_probe_data *probe_data)
{
struct efx_nic *efx = &probe_data->efx;
@@ -387,9 +409,7 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
ESE_EF100_DP_GZ_TSO_MAX_HDR_NUM_SEGS_DEFAULT);
efx->mdio.dev = net_dev;

- rc = efx_ef100_init_datapath_caps(efx);
- if (rc < 0)
- goto fail;
+ efx_ef100_update_tso_features(efx);

rc = ef100_phy_probe(efx);
if (rc)
diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
index 8cbe5e0f4bdf..ef6e295efcf7 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.c
+++ b/drivers/net/ethernet/sfc/ef100_nic.c
@@ -161,7 +161,7 @@ int ef100_get_mac_address(struct efx_nic *efx, u8 *mac_address,
return 0;
}

-int efx_ef100_init_datapath_caps(struct efx_nic *efx)
+static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
{
MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_V7_OUT_LEN);
struct ef100_nic_data *nic_data = efx->nic_data;
@@ -197,25 +197,15 @@ int efx_ef100_init_datapath_caps(struct efx_nic *efx)
if (rc)
return rc;

- if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) {
- struct net_device *net_dev = efx->net_dev;
- netdev_features_t tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
- NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
- NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
-
- net_dev->features |= tso;
- net_dev->hw_features |= tso;
- net_dev->hw_enc_features |= tso;
- /* EF100 HW can only offload outer checksums if they are UDP,
- * so for GRE_CSUM we have to use GSO_PARTIAL.
- */
- net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
- }
efx->num_mac_stats = MCDI_WORD(outbuf,
GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS);
netif_dbg(efx, probe, efx->net_dev,
"firmware reports num_mac_stats = %u\n",
efx->num_mac_stats);
+
+ nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
+ CLIENT_CMD_VF_PROXY) &&
+ efx->type->is_vf;
return 0;
}

@@ -806,13 +796,6 @@ static char *bar_config_name[] = {
[EF100_BAR_CONFIG_VDPA] = "vDPA",
};

-#ifdef CONFIG_SFC_VDPA
-static bool efx_vdpa_supported(struct efx_nic *efx)
-{
- return efx->type->is_vf;
-}
-#endif
-
int efx_ef100_set_bar_config(struct efx_nic *efx,
enum ef100_bar_config new_config)
{
@@ -828,7 +811,7 @@ int efx_ef100_set_bar_config(struct efx_nic *efx,

#ifdef CONFIG_SFC_VDPA
/* Current EF100 hardware supports vDPA on VFs only */
- if (new_config == EF100_BAR_CONFIG_VDPA && !efx_vdpa_supported(efx)) {
+ if (new_config == EF100_BAR_CONFIG_VDPA && !nic_data->vdpa_supported) {
pci_err(efx->pci_dev, "vdpa over PF not supported : %s",
efx->name);
return -EOPNOTSUPP;
@@ -1208,6 +1191,12 @@ static int ef100_probe_main(struct efx_nic *efx)
goto fail;
}

+ rc = efx_ef100_init_datapath_caps(efx);
+ if (rc) {
+ pci_info(efx->pci_dev, "Unable to initialize datapath caps\n");
+ goto fail;
+ }
+
return 0;
fail:
return rc;
diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h
index 4562982f2965..117a73d0795c 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.h
+++ b/drivers/net/ethernet/sfc/ef100_nic.h
@@ -76,6 +76,9 @@ struct ef100_nic_data {
u32 datapath_caps3;
unsigned int pf_index;
u16 warm_boot_count;
+#ifdef CONFIG_SFC_VDPA
+ bool vdpa_supported; /* true if vdpa is supported on this PCIe FN */
+#endif
u8 port_id[ETH_ALEN];
DECLARE_BITMAP(evq_phases, EFX_MAX_CHANNELS);
enum ef100_bar_config bar_config;
@@ -95,9 +98,8 @@ struct ef100_nic_data {
};

#define efx_ef100_has_cap(caps, flag) \
- (!!((caps) & BIT_ULL(MC_CMD_GET_CAPABILITIES_V4_OUT_ ## flag ## _LBN)))
+ (!!((caps) & BIT_ULL(MC_CMD_GET_CAPABILITIES_V7_OUT_ ## flag ## _LBN)))

-int efx_ef100_init_datapath_caps(struct efx_nic *efx);
int ef100_phy_probe(struct efx_nic *efx);
int ef100_filter_table_probe(struct efx_nic *efx);

diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
index f6564448d0c7..90062fd8a25d 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.h
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
-/* Driver for Xilinx network controllers and boards
- * Copyright (C) 2020-2022, Xilinx, Inc.
- * Copyright (C) 2022, Advanced Micro Devices, Inc.
+/* Driver for AMD network controllers and boards
+ * Copyright (C) 2023, Advanced Micro Devices, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
--
2.30.1


2023-03-07 11:40:18

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 06/14] sfc: implement vDPA management device operations

To allow vDPA device creation and deletion, add a vDPA management
device per function. Currently, the vDPA devices can be created
only on a VF. Also, for now only network class of vDPA devices
are supported.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/Makefile | 2 +-
drivers/net/ethernet/sfc/ef10.c | 2 +-
drivers/net/ethernet/sfc/ef100_nic.c | 27 ++-
drivers/net/ethernet/sfc/ef100_nic.h | 9 +
drivers/net/ethernet/sfc/ef100_vdpa.c | 228 ++++++++++++++++++++++
drivers/net/ethernet/sfc/ef100_vdpa.h | 84 ++++++++
drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 30 +++
drivers/net/ethernet/sfc/mcdi_functions.c | 9 +-
drivers/net/ethernet/sfc/mcdi_functions.h | 3 +-
drivers/net/ethernet/sfc/net_driver.h | 6 +
10 files changed, 393 insertions(+), 7 deletions(-)
create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa_ops.c

diff --git a/drivers/net/ethernet/sfc/Makefile b/drivers/net/ethernet/sfc/Makefile
index 3a2bb98d1c3f..bd8ba588b968 100644
--- a/drivers/net/ethernet/sfc/Makefile
+++ b/drivers/net/ethernet/sfc/Makefile
@@ -12,7 +12,7 @@ sfc-$(CONFIG_SFC_MTD) += mtd.o
sfc-$(CONFIG_SFC_SRIOV) += sriov.o ef10_sriov.o ef100_sriov.o ef100_rep.o \
mae.o tc.o tc_bindings.o tc_counters.o

-sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o ef100_vdpa.o
+sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o ef100_vdpa.o ef100_vdpa_ops.o
obj-$(CONFIG_SFC) += sfc.o

obj-$(CONFIG_SFC_FALCON) += falcon/
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 7022fb2005a2..366ecd3c80b1 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -589,7 +589,7 @@ static int efx_ef10_probe(struct efx_nic *efx)
if (rc)
goto fail4;

- rc = efx_get_pf_index(efx, &nic_data->pf_index);
+ rc = efx_get_fn_info(efx, &nic_data->pf_index, NULL);
if (rc)
goto fail5;

diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
index 8a9fff239d07..bda4fcbe1126 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.c
+++ b/drivers/net/ethernet/sfc/ef100_nic.c
@@ -1164,7 +1164,7 @@ static int ef100_probe_main(struct efx_nic *efx)
if (rc)
goto fail;

- rc = efx_get_pf_index(efx, &nic_data->pf_index);
+ rc = efx_get_fn_info(efx, &nic_data->pf_index, &nic_data->vf_index);
if (rc)
goto fail;

@@ -1280,13 +1280,36 @@ int ef100_probe_netdev_pf(struct efx_nic *efx)

int ef100_probe_vf(struct efx_nic *efx)
{
- return ef100_probe_main(efx);
+#if defined(CONFIG_SFC_VDPA)
+ struct ef100_nic_data *nic_data;
+ int err;
+#endif
+ int rc;
+
+ rc = ef100_probe_main(efx);
+ if (rc)
+ return rc;
+
+#if defined(CONFIG_SFC_VDPA)
+ nic_data = efx->nic_data;
+ if (nic_data->vdpa_supported) {
+ err = ef100_vdpa_register_mgmtdev(efx);
+ if (err)
+ pci_warn(efx->pci_dev,
+ "vdpa_register_mgmtdev failed, rc: %d\n", err);
+ }
+#endif
+ return 0;
}

void ef100_remove(struct efx_nic *efx)
{
struct ef100_nic_data *nic_data = efx->nic_data;

+#if defined(CONFIG_SFC_VDPA)
+ if (nic_data->vdpa_supported)
+ ef100_vdpa_unregister_mgmtdev(efx);
+#endif
if (IS_ENABLED(CONFIG_SFC_SRIOV) && efx->mae) {
efx_ef100_fini_reps(efx);
efx_fini_mae(efx);
diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h
index 117a73d0795c..71404bfc2a5a 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.h
+++ b/drivers/net/ethernet/sfc/ef100_nic.h
@@ -68,6 +68,13 @@ enum ef100_bar_config {
EF100_BAR_CONFIG_VDPA,
};

+#ifdef CONFIG_SFC_VDPA
+enum ef100_vdpa_class {
+ EF100_VDPA_CLASS_NONE,
+ EF100_VDPA_CLASS_NET,
+};
+#endif
+
struct ef100_nic_data {
struct efx_nic *efx;
struct efx_buffer mcdi_buf;
@@ -75,9 +82,11 @@ struct ef100_nic_data {
u32 datapath_caps2;
u32 datapath_caps3;
unsigned int pf_index;
+ unsigned int vf_index;
u16 warm_boot_count;
#ifdef CONFIG_SFC_VDPA
bool vdpa_supported; /* true if vdpa is supported on this PCIe FN */
+ enum ef100_vdpa_class vdpa_class;
#endif
u8 port_id[ETH_ALEN];
DECLARE_BITMAP(evq_phases, EFX_MAX_CHANNELS);
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
index 268c973f7376..4c5a98c9d6c3 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
@@ -10,11 +10,17 @@
#include <linux/err.h>
#include <linux/vdpa.h>
#include <linux/virtio_net.h>
+#include <uapi/linux/vdpa.h>
#include "ef100_vdpa.h"
#include "mcdi_vdpa.h"
#include "mcdi_filters.h"
#include "ef100_netdev.h"

+static struct virtio_device_id ef100_vdpa_id_table[] = {
+ { .device = VIRTIO_ID_NET, .vendor = PCI_VENDOR_ID_REDHAT_QUMRANET },
+ { 0 },
+};
+
int ef100_vdpa_init(struct efx_probe_data *probe_data)
{
struct efx_nic *efx = &probe_data->efx;
@@ -41,17 +47,239 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data)
return rc;
}

+static void ef100_vdpa_delete(struct efx_nic *efx)
+{
+ if (efx->vdpa_nic) {
+ /* replace with _vdpa_unregister_device later */
+ put_device(&efx->vdpa_nic->vdpa_dev.dev);
+ }
+}
+
void ef100_vdpa_fini(struct efx_probe_data *probe_data)
{
struct efx_nic *efx = &probe_data->efx;
+ struct ef100_nic_data *nic_data;

if (efx->state != STATE_VDPA && efx->state != STATE_DISABLED) {
pci_err(efx->pci_dev, "Invalid efx state %u", efx->state);
return;
}

+ /* Handle vdpa device deletion, if not done explicitly */
+ ef100_vdpa_delete(efx);
+ nic_data = efx->nic_data;
+ nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
efx->state = STATE_PROBED;
down_write(&efx->filter_sem);
efx_mcdi_filter_table_remove(efx);
up_write(&efx->filter_sem);
}
+
+static int get_net_config(struct ef100_vdpa_nic *vdpa_nic)
+{
+ struct efx_nic *efx = vdpa_nic->efx;
+ u16 mtu;
+ int rc;
+
+ vdpa_nic->net_config.max_virtqueue_pairs =
+ cpu_to_efx_vdpa16(vdpa_nic, vdpa_nic->max_queue_pairs);
+
+ rc = efx_vdpa_get_mtu(efx, &mtu);
+ if (rc) {
+ dev_err(&vdpa_nic->vdpa_dev.dev,
+ "%s: Get MTU for vf:%u failed:%d\n", __func__,
+ vdpa_nic->vf_index, rc);
+ return rc;
+ }
+ vdpa_nic->net_config.mtu = cpu_to_efx_vdpa16(vdpa_nic, mtu);
+ vdpa_nic->net_config.status = cpu_to_efx_vdpa16(vdpa_nic,
+ VIRTIO_NET_S_LINK_UP);
+ return 0;
+}
+
+static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
+ const char *dev_name,
+ enum ef100_vdpa_class dev_type,
+ const u8 *mac)
+{
+ struct ef100_nic_data *nic_data = efx->nic_data;
+ struct ef100_vdpa_nic *vdpa_nic;
+ int rc;
+
+ nic_data->vdpa_class = dev_type;
+ vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
+ vdpa_dev, &efx->pci_dev->dev,
+ &ef100_vdpa_config_ops,
+ 1, 1,
+ dev_name, false);
+ if (!vdpa_nic) {
+ pci_err(efx->pci_dev,
+ "vDPA device allocation failed for vf: %u\n",
+ nic_data->vf_index);
+ nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
+ return ERR_PTR(-ENOMEM);
+ }
+
+ mutex_init(&vdpa_nic->lock);
+ efx->vdpa_nic = vdpa_nic;
+ vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
+ vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
+ vdpa_nic->efx = efx;
+ vdpa_nic->pf_index = nic_data->pf_index;
+ vdpa_nic->vf_index = nic_data->vf_index;
+ vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
+ vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;
+
+ rc = get_net_config(vdpa_nic);
+ if (rc)
+ goto err_put_device;
+
+ if (mac) {
+ ether_addr_copy(vdpa_nic->mac_address, mac);
+ vdpa_nic->mac_configured = true;
+ }
+
+ /* _vdpa_register_device when its ready */
+
+ return vdpa_nic;
+
+err_put_device:
+ /* put_device invokes ef100_vdpa_free */
+ put_device(&vdpa_nic->vdpa_dev.dev);
+ return ERR_PTR(rc);
+}
+
+static void ef100_vdpa_net_dev_del(struct vdpa_mgmt_dev *mgmt_dev,
+ struct vdpa_device *vdev)
+{
+ struct ef100_nic_data *nic_data;
+ struct efx_nic *efx;
+ int rc;
+
+ efx = pci_get_drvdata(to_pci_dev(mgmt_dev->device));
+ nic_data = efx->nic_data;
+
+ rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
+ if (rc)
+ pci_err(efx->pci_dev,
+ "set_bar_config EF100 failed, err: %d\n", rc);
+ else
+ pci_dbg(efx->pci_dev,
+ "vdpa net device deleted, vf: %u\n",
+ nic_data->vf_index);
+}
+
+static int ef100_vdpa_net_dev_add(struct vdpa_mgmt_dev *mgmt_dev,
+ const char *name,
+ const struct vdpa_dev_set_config *config)
+{
+ struct ef100_vdpa_nic *vdpa_nic;
+ struct ef100_nic_data *nic_data;
+ const u8 *mac = NULL;
+ struct efx_nic *efx;
+ int rc, err;
+
+ if (config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
+ if (!is_valid_ether_addr(config->net.mac)) {
+ pci_err(efx->pci_dev, "Invalid MAC address %pM\n",
+ config->net.mac);
+ return -EINVAL;
+ }
+ mac = (const u8 *)config->net.mac;
+ }
+
+ efx = pci_get_drvdata(to_pci_dev(mgmt_dev->device));
+ if (efx->vdpa_nic) {
+ pci_warn(efx->pci_dev,
+ "vDPA device already exists on this VF\n");
+ return -EEXIST;
+ }
+
+ nic_data = efx->nic_data;
+
+ rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_VDPA);
+ if (rc) {
+ pci_err(efx->pci_dev,
+ "set_bar_config vDPA failed, err: %d\n", rc);
+ goto err_set_bar_config;
+ }
+
+ vdpa_nic = ef100_vdpa_create(efx, name, EF100_VDPA_CLASS_NET, mac);
+ if (IS_ERR(vdpa_nic)) {
+ pci_err(efx->pci_dev,
+ "vDPA device creation failed, vf: %u, err: %ld\n",
+ nic_data->vf_index, PTR_ERR(vdpa_nic));
+ rc = PTR_ERR(vdpa_nic);
+ goto err_set_bar_config;
+ } else {
+ pci_dbg(efx->pci_dev,
+ "vdpa net device created, vf: %u\n",
+ nic_data->vf_index);
+ }
+
+ return 0;
+
+err_set_bar_config:
+ err = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
+ if (err)
+ pci_err(efx->pci_dev,
+ "set_bar_config EF100 failed, err: %d\n", err);
+
+ return rc;
+}
+
+static const struct vdpa_mgmtdev_ops ef100_vdpa_net_mgmtdev_ops = {
+ .dev_add = ef100_vdpa_net_dev_add,
+ .dev_del = ef100_vdpa_net_dev_del
+};
+
+int ef100_vdpa_register_mgmtdev(struct efx_nic *efx)
+{
+ struct vdpa_mgmt_dev *mgmt_dev;
+ u64 features;
+ int rc;
+
+ mgmt_dev = kzalloc(sizeof(*mgmt_dev), GFP_KERNEL);
+ if (!mgmt_dev)
+ return -ENOMEM;
+
+ rc = efx_vdpa_get_features(efx, EF100_VDPA_DEVICE_TYPE_NET, &features);
+ if (rc) {
+ pci_err(efx->pci_dev, "%s: MCDI get features error:%d\n",
+ __func__, rc);
+ goto err_get_features;
+ }
+
+ efx->mgmt_dev = mgmt_dev;
+ mgmt_dev->device = &efx->pci_dev->dev;
+ mgmt_dev->id_table = ef100_vdpa_id_table;
+ mgmt_dev->ops = &ef100_vdpa_net_mgmtdev_ops;
+ mgmt_dev->supported_features = features;
+ mgmt_dev->max_supported_vqs = EF100_VDPA_MAX_QUEUES_PAIRS * 2;
+ mgmt_dev->config_attr_mask = BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR);
+
+ rc = vdpa_mgmtdev_register(mgmt_dev);
+ if (rc) {
+ pci_err(efx->pci_dev,
+ "vdpa_mgmtdev_register failed, err: %d\n", rc);
+ goto err_mgmtdev_register;
+ }
+
+ return 0;
+
+err_mgmtdev_register:
+err_get_features:
+ kfree(mgmt_dev);
+ efx->mgmt_dev = NULL;
+
+ return rc;
+}
+
+void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx)
+{
+ if (efx->mgmt_dev) {
+ vdpa_mgmtdev_unregister(efx->mgmt_dev);
+ kfree(efx->mgmt_dev);
+ efx->mgmt_dev = NULL;
+ }
+}
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
index ccc5eb0a2a84..1101b30f56e7 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.h
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
@@ -17,6 +17,24 @@

#if defined(CONFIG_SFC_VDPA)

+/* Max queue pairs currently supported */
+#define EF100_VDPA_MAX_QUEUES_PAIRS 1
+
+/**
+ * enum ef100_vdpa_nic_state - possible states for a vDPA NIC
+ *
+ * @EF100_VDPA_STATE_INITIALIZED: State after vDPA NIC created
+ * @EF100_VDPA_STATE_NEGOTIATED: State after feature negotiation
+ * @EF100_VDPA_STATE_STARTED: State after driver ok
+ * @EF100_VDPA_STATE_NSTATES: Number of VDPA states
+ */
+enum ef100_vdpa_nic_state {
+ EF100_VDPA_STATE_INITIALIZED,
+ EF100_VDPA_STATE_NEGOTIATED,
+ EF100_VDPA_STATE_STARTED,
+ EF100_VDPA_STATE_NSTATES
+};
+
enum ef100_vdpa_device_type {
EF100_VDPA_DEVICE_TYPE_NET,
};
@@ -27,7 +45,73 @@ enum ef100_vdpa_vq_type {
EF100_VDPA_VQ_NTYPES
};

+/**
+ * struct ef100_vdpa_nic - vDPA NIC data structure
+ *
+ * @vdpa_dev: vdpa_device object which registers on the vDPA bus.
+ * @vdpa_state: NIC state machine governed by ef100_vdpa_nic_state
+ * @efx: pointer to the VF's efx_nic object
+ * @lock: Managing access to vdpa config operations
+ * @pf_index: PF index of the vDPA VF
+ * @vf_index: VF index of the vDPA VF
+ * @status: device status as per VIRTIO spec
+ * @features: negotiated feature bits
+ * @max_queue_pairs: maximum number of queue pairs supported
+ * @net_config: virtio_net_config data
+ * @mac_address: mac address of interface associated with this vdpa device
+ * @mac_configured: true after MAC address is configured
+ */
+struct ef100_vdpa_nic {
+ struct vdpa_device vdpa_dev;
+ enum ef100_vdpa_nic_state vdpa_state;
+ struct efx_nic *efx;
+ /* for synchronizing access to vdpa config operations */
+ struct mutex lock;
+ u32 pf_index;
+ u32 vf_index;
+ u8 status;
+ u64 features;
+ u32 max_queue_pairs;
+ struct virtio_net_config net_config;
+ u8 *mac_address;
+ bool mac_configured;
+};
+
int ef100_vdpa_init(struct efx_probe_data *probe_data);
void ef100_vdpa_fini(struct efx_probe_data *probe_data);
+int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
+void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
+
+static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
+{
+ return virtio_legacy_is_little_endian() ||
+ (vdpa_nic->features & (1ULL << VIRTIO_F_VERSION_1));
+}
+
+static inline u16 efx_vdpa16_to_cpu(struct ef100_vdpa_nic *vdpa_nic,
+ __virtio16 val)
+{
+ return __virtio16_to_cpu(efx_vdpa_is_little_endian(vdpa_nic), val);
+}
+
+static inline __virtio16 cpu_to_efx_vdpa16(struct ef100_vdpa_nic *vdpa_nic,
+ u16 val)
+{
+ return __cpu_to_virtio16(efx_vdpa_is_little_endian(vdpa_nic), val);
+}
+
+static inline u32 efx_vdpa32_to_cpu(struct ef100_vdpa_nic *vdpa_nic,
+ __virtio32 val)
+{
+ return __virtio32_to_cpu(efx_vdpa_is_little_endian(vdpa_nic), val);
+}
+
+static inline __virtio32 cpu_to_efx_vdpa32(struct ef100_vdpa_nic *vdpa_nic,
+ u32 val)
+{
+ return __cpu_to_virtio32(efx_vdpa_is_little_endian(vdpa_nic), val);
+}
+
+extern const struct vdpa_config_ops ef100_vdpa_config_ops;
#endif /* CONFIG_SFC_VDPA */
#endif /* __EF100_VDPA_H__ */
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
new file mode 100644
index 000000000000..f1ce011adc43
--- /dev/null
+++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Driver for AMD network controllers and boards
+ * Copyright(C) 2023, Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation, incorporated herein by reference.
+ */
+
+#include <linux/vdpa.h>
+#include "ef100_vdpa.h"
+
+static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
+{
+ return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
+}
+
+static void ef100_vdpa_free(struct vdpa_device *vdev)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ if (vdpa_nic) {
+ mutex_destroy(&vdpa_nic->lock);
+ vdpa_nic->efx->vdpa_nic = NULL;
+ }
+}
+
+const struct vdpa_config_ops ef100_vdpa_config_ops = {
+ .free = ef100_vdpa_free,
+};
diff --git a/drivers/net/ethernet/sfc/mcdi_functions.c b/drivers/net/ethernet/sfc/mcdi_functions.c
index d3e6d8239f5c..4415f19cf68f 100644
--- a/drivers/net/ethernet/sfc/mcdi_functions.c
+++ b/drivers/net/ethernet/sfc/mcdi_functions.c
@@ -413,7 +413,8 @@ int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode)
return 0;
}

-int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index)
+int efx_get_fn_info(struct efx_nic *efx, unsigned int *pf_index,
+ unsigned int *vf_index)
{
MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN);
size_t outlen;
@@ -426,6 +427,10 @@ int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index)
if (outlen < sizeof(outbuf))
return -EIO;

- *pf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_PF);
+ if (pf_index)
+ *pf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_PF);
+
+ if (efx->type->is_vf && vf_index)
+ *vf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_VF);
return 0;
}
diff --git a/drivers/net/ethernet/sfc/mcdi_functions.h b/drivers/net/ethernet/sfc/mcdi_functions.h
index b0e2f53a0d9b..76dc0a13463e 100644
--- a/drivers/net/ethernet/sfc/mcdi_functions.h
+++ b/drivers/net/ethernet/sfc/mcdi_functions.h
@@ -28,6 +28,7 @@ void efx_mcdi_rx_remove(struct efx_rx_queue *rx_queue);
void efx_mcdi_rx_fini(struct efx_rx_queue *rx_queue);
int efx_fini_dmaq(struct efx_nic *efx);
int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode);
-int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index);
+int efx_get_fn_info(struct efx_nic *efx, unsigned int *pf_index,
+ unsigned int *vf_index);

#endif
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 3dc9eae5a81d..1da71deac71c 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -1090,6 +1090,12 @@ struct efx_nic {
int rx_packet_len_offset;
int rx_packet_ts_offset;
bool rx_scatter;
+#ifdef CONFIG_SFC_VDPA
+ /** @mgmt_dev: vDPA Management device */
+ struct vdpa_mgmt_dev *mgmt_dev;
+ /** @vdpa_nic: vDPA device structure (EF100) */
+ struct ef100_vdpa_nic *vdpa_nic;
+#endif
struct efx_rss_context rss_context;
struct mutex rss_lock;
u32 vport_id;
--
2.30.1


2023-03-07 11:40:26

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 07/14] sfc: implement vdpa device config operations

vDPA config operations can be broadly categorized in to either
virtqueue operations, device operations or DMA operations.
This patch implements most of the device level config operations.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/ef100_vdpa.h | 14 +++
drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 131 ++++++++++++++++++++++
2 files changed, 145 insertions(+)

diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
index 1101b30f56e7..dcf4a8156415 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.h
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
@@ -20,6 +20,18 @@
/* Max queue pairs currently supported */
#define EF100_VDPA_MAX_QUEUES_PAIRS 1

+/* Device ID of a virtio net device */
+#define EF100_VDPA_VIRTIO_NET_DEVICE_ID VIRTIO_ID_NET
+
+/* Vendor ID of Xilinx vDPA NIC */
+#define EF100_VDPA_VENDOR_ID PCI_VENDOR_ID_XILINX
+
+/* Max number of Buffers supported in the virtqueue */
+#define EF100_VDPA_VQ_NUM_MAX_SIZE 512
+
+/* Alignment requirement of the Virtqueue */
+#define EF100_VDPA_VQ_ALIGN 4096
+
/**
* enum ef100_vdpa_nic_state - possible states for a vDPA NIC
*
@@ -60,6 +72,7 @@ enum ef100_vdpa_vq_type {
* @net_config: virtio_net_config data
* @mac_address: mac address of interface associated with this vdpa device
* @mac_configured: true after MAC address is configured
+ * @cfg_cb: callback for config change
*/
struct ef100_vdpa_nic {
struct vdpa_device vdpa_dev;
@@ -75,6 +88,7 @@ struct ef100_vdpa_nic {
struct virtio_net_config net_config;
u8 *mac_address;
bool mac_configured;
+ struct vdpa_callback cfg_cb;
};

int ef100_vdpa_init(struct efx_probe_data *probe_data);
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
index f1ce011adc43..a2364ef9f492 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
@@ -9,12 +9,131 @@

#include <linux/vdpa.h>
#include "ef100_vdpa.h"
+#include "mcdi_vdpa.h"

static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
{
return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
}

+static u32 ef100_vdpa_get_vq_align(struct vdpa_device *vdev)
+{
+ return EF100_VDPA_VQ_ALIGN;
+}
+
+static u64 ef100_vdpa_get_device_features(struct vdpa_device *vdev)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ u64 features;
+ int rc;
+
+ rc = efx_vdpa_get_features(vdpa_nic->efx,
+ EF100_VDPA_DEVICE_TYPE_NET, &features);
+ if (rc) {
+ dev_err(&vdev->dev, "%s: MCDI get features error:%d\n",
+ __func__, rc);
+ /* Returning 0 as value of features will lead to failure
+ * of feature negotiation.
+ */
+ return 0;
+ }
+
+ features |= BIT_ULL(VIRTIO_NET_F_MAC);
+ return features;
+}
+
+static int ef100_vdpa_set_driver_features(struct vdpa_device *vdev,
+ u64 features)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ u64 verify_features;
+ int rc;
+
+ mutex_lock(&vdpa_nic->lock);
+ verify_features = features & ~BIT_ULL(VIRTIO_NET_F_MAC);
+ rc = efx_vdpa_verify_features(vdpa_nic->efx,
+ EF100_VDPA_DEVICE_TYPE_NET,
+ verify_features);
+ if (rc) {
+ dev_err(&vdev->dev, "%s: MCDI verify features error:%d\n",
+ __func__, rc);
+ goto err;
+ }
+
+ vdpa_nic->features = features;
+err:
+ mutex_unlock(&vdpa_nic->lock);
+ return rc;
+}
+
+static u64 ef100_vdpa_get_driver_features(struct vdpa_device *vdev)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ return vdpa_nic->features;
+}
+
+static void ef100_vdpa_set_config_cb(struct vdpa_device *vdev,
+ struct vdpa_callback *cb)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ if (cb)
+ vdpa_nic->cfg_cb = *cb;
+}
+
+static u16 ef100_vdpa_get_vq_num_max(struct vdpa_device *vdev)
+{
+ return EF100_VDPA_VQ_NUM_MAX_SIZE;
+}
+
+static u32 ef100_vdpa_get_device_id(struct vdpa_device *vdev)
+{
+ return EF100_VDPA_VIRTIO_NET_DEVICE_ID;
+}
+
+static u32 ef100_vdpa_get_vendor_id(struct vdpa_device *vdev)
+{
+ return EF100_VDPA_VENDOR_ID;
+}
+
+static size_t ef100_vdpa_get_config_size(struct vdpa_device *vdev)
+{
+ return sizeof(struct virtio_net_config);
+}
+
+static void ef100_vdpa_get_config(struct vdpa_device *vdev,
+ unsigned int offset,
+ void *buf, unsigned int len)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ /* Avoid the possibility of wrap-up after the sum exceeds U32_MAX */
+ if (WARN_ON(((u64)offset + len) > sizeof(struct virtio_net_config))) {
+ dev_err(&vdev->dev,
+ "%s: Offset + len exceeds config size\n", __func__);
+ return;
+ }
+ memcpy(buf, (u8 *)&vdpa_nic->net_config + offset, len);
+}
+
+static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
+ const void *buf, unsigned int len)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ /* Avoid the possibility of wrap-up after the sum exceeds U32_MAX */
+ if (WARN_ON(((u64)offset + len) > sizeof(vdpa_nic->net_config))) {
+ dev_err(&vdev->dev,
+ "%s: Offset + len exceeds config size\n", __func__);
+ return;
+ }
+
+ memcpy((u8 *)&vdpa_nic->net_config + offset, buf, len);
+ if (is_valid_ether_addr(vdpa_nic->mac_address))
+ vdpa_nic->mac_configured = true;
+}
+
static void ef100_vdpa_free(struct vdpa_device *vdev)
{
struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
@@ -26,5 +145,17 @@ static void ef100_vdpa_free(struct vdpa_device *vdev)
}

const struct vdpa_config_ops ef100_vdpa_config_ops = {
+ .get_vq_align = ef100_vdpa_get_vq_align,
+ .get_device_features = ef100_vdpa_get_device_features,
+ .set_driver_features = ef100_vdpa_set_driver_features,
+ .get_driver_features = ef100_vdpa_get_driver_features,
+ .set_config_cb = ef100_vdpa_set_config_cb,
+ .get_vq_num_max = ef100_vdpa_get_vq_num_max,
+ .get_device_id = ef100_vdpa_get_device_id,
+ .get_vendor_id = ef100_vdpa_get_vendor_id,
+ .get_config_size = ef100_vdpa_get_config_size,
+ .get_config = ef100_vdpa_get_config,
+ .set_config = ef100_vdpa_set_config,
+ .get_generation = NULL,
.free = ef100_vdpa_free,
};
--
2.30.1


2023-03-07 11:40:32

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 05/14] sfc: implement init and fini functions for vDPA personality

When the bar_config for a PCIe function is changed from
EF100 to vDPA or vice-versa, corresponding EF100/vDPA fini/init
functions are invoked.
Also, because of the fact that a vDPA device doesn't have an
associated net device i.e. efx->net_dev is NULL, the code in
efx_mcdi_filter_table_probe() has been re-structured to have
the common code for both EF100 and vDPA personalities first
and then return early for vDPA case (before efx->net_dev is
accessed for EF100 personality).

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/Makefile | 2 +-
drivers/net/ethernet/sfc/ef100_nic.c | 7 ++-
drivers/net/ethernet/sfc/ef100_vdpa.c | 57 +++++++++++++++++++++++++
drivers/net/ethernet/sfc/ef100_vdpa.h | 2 +
drivers/net/ethernet/sfc/mcdi_filters.c | 51 ++++++++++++----------
drivers/net/ethernet/sfc/net_driver.h | 1 +
6 files changed, 95 insertions(+), 25 deletions(-)
create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa.c

diff --git a/drivers/net/ethernet/sfc/Makefile b/drivers/net/ethernet/sfc/Makefile
index fb94fe3a9dfc..3a2bb98d1c3f 100644
--- a/drivers/net/ethernet/sfc/Makefile
+++ b/drivers/net/ethernet/sfc/Makefile
@@ -12,7 +12,7 @@ sfc-$(CONFIG_SFC_MTD) += mtd.o
sfc-$(CONFIG_SFC_SRIOV) += sriov.o ef10_sriov.o ef100_sriov.o ef100_rep.o \
mae.o tc.o tc_bindings.o tc_counters.o

-sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o
+sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o ef100_vdpa.o
obj-$(CONFIG_SFC) += sfc.o

obj-$(CONFIG_SFC_FALCON) += falcon/
diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
index ef6e295efcf7..8a9fff239d07 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.c
+++ b/drivers/net/ethernet/sfc/ef100_nic.c
@@ -27,6 +27,9 @@
#include "tc.h"
#include "mae.h"
#include "rx_common.h"
+#ifdef CONFIG_SFC_VDPA
+#include "ef100_vdpa.h"
+#endif

#define EF100_MAX_VIS 4096
#define EF100_NUM_MCDI_BUFFERS 1
@@ -779,8 +782,8 @@ static const struct ef100_bar_config_ops bar_config_ops[] = {
},
#ifdef CONFIG_SFC_VDPA
[EF100_BAR_CONFIG_VDPA] = {
- .init = NULL,
- .fini = NULL
+ .init = ef100_vdpa_init,
+ .fini = ef100_vdpa_fini
},
#endif
[EF100_BAR_CONFIG_NONE] = {
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
new file mode 100644
index 000000000000..268c973f7376
--- /dev/null
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Driver for AMD network controllers and boards
+ * Copyright(C) 2023, Advanced Micro Devices, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation, incorporated herein by reference.
+ */
+
+#include <linux/err.h>
+#include <linux/vdpa.h>
+#include <linux/virtio_net.h>
+#include "ef100_vdpa.h"
+#include "mcdi_vdpa.h"
+#include "mcdi_filters.h"
+#include "ef100_netdev.h"
+
+int ef100_vdpa_init(struct efx_probe_data *probe_data)
+{
+ struct efx_nic *efx = &probe_data->efx;
+ int rc;
+
+ if (efx->state != STATE_PROBED) {
+ pci_err(efx->pci_dev, "Invalid efx state %u", efx->state);
+ return -EBUSY;
+ }
+
+ efx->state = STATE_VDPA;
+ down_write(&efx->filter_sem);
+ rc = ef100_filter_table_probe(efx);
+ up_write(&efx->filter_sem);
+ if (rc) {
+ pci_err(efx->pci_dev, "filter probe failed, err: %d\n", rc);
+ goto fail;
+ }
+
+ return 0;
+
+fail:
+ efx->state = STATE_PROBED;
+ return rc;
+}
+
+void ef100_vdpa_fini(struct efx_probe_data *probe_data)
+{
+ struct efx_nic *efx = &probe_data->efx;
+
+ if (efx->state != STATE_VDPA && efx->state != STATE_DISABLED) {
+ pci_err(efx->pci_dev, "Invalid efx state %u", efx->state);
+ return;
+ }
+
+ efx->state = STATE_PROBED;
+ down_write(&efx->filter_sem);
+ efx_mcdi_filter_table_remove(efx);
+ up_write(&efx->filter_sem);
+}
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
index 90062fd8a25d..ccc5eb0a2a84 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.h
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
@@ -27,5 +27,7 @@ enum ef100_vdpa_vq_type {
EF100_VDPA_VQ_NTYPES
};

+int ef100_vdpa_init(struct efx_probe_data *probe_data);
+void ef100_vdpa_fini(struct efx_probe_data *probe_data);
#endif /* CONFIG_SFC_VDPA */
#endif /* __EF100_VDPA_H__ */
diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c
index 4ff6586116ee..fde2b5b50ade 100644
--- a/drivers/net/ethernet/sfc/mcdi_filters.c
+++ b/drivers/net/ethernet/sfc/mcdi_filters.c
@@ -1282,14 +1282,14 @@ efx_mcdi_filter_table_probe_matches(struct efx_nic *efx,
pd_match_pri);
rc = efx_mcdi_filter_match_flags_from_mcdi(encap, mcdi_flags);
if (rc < 0) {
- netif_dbg(efx, probe, efx->net_dev,
- "%s: fw flags %#x pri %u not supported in driver\n",
- __func__, mcdi_flags, pd_match_pri);
+ pci_dbg(efx->pci_dev,
+ "%s: fw flags %#x pri %u not supported in driver\n",
+ __func__, mcdi_flags, pd_match_pri);
} else {
- netif_dbg(efx, probe, efx->net_dev,
- "%s: fw flags %#x pri %u supported as driver flags %#x pri %u\n",
- __func__, mcdi_flags, pd_match_pri,
- rc, table->rx_match_count);
+ pci_dbg(efx->pci_dev,
+ "%s: fw flags %#x pri %u supported as driver flags %#x pri %u\n",
+ __func__, mcdi_flags, pd_match_pri,
+ rc, table->rx_match_count);
table->rx_match_mcdi_flags[table->rx_match_count] = mcdi_flags;
table->rx_match_count++;
}
@@ -1318,11 +1318,26 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining)
table->rx_match_count = 0;
rc = efx_mcdi_filter_table_probe_matches(efx, table, false);
if (rc)
- goto fail;
+ goto fail1;
+ table->entry = vzalloc(array_size(EFX_MCDI_FILTER_TBL_ROWS,
+ sizeof(*table->entry)));
+ if (!table->entry) {
+ rc = -ENOMEM;
+ goto fail1;
+ }
+
+ table->mc_promisc_last = false;
+ INIT_LIST_HEAD(&table->vlan_list);
+ init_rwsem(&table->lock);
+
+ efx->filter_state = table;
+ if (efx->state == STATE_VDPA)
+ return 0;
+
if (efx_has_cap(efx, VXLAN_NVGRE))
rc = efx_mcdi_filter_table_probe_matches(efx, table, true);
if (rc)
- goto fail;
+ goto fail2;
if ((efx_supported_features(efx) & NETIF_F_HW_VLAN_CTAG_FILTER) &&
!(efx_mcdi_filter_match_supported(table, false,
(EFX_FILTER_MATCH_OUTER_VID | EFX_FILTER_MATCH_LOC_MAC)) &&
@@ -1335,24 +1350,16 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx, bool multicast_chaining)
net_dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
}

- table->entry = vzalloc(array_size(EFX_MCDI_FILTER_TBL_ROWS,
- sizeof(*table->entry)));
- if (!table->entry) {
- rc = -ENOMEM;
- goto fail;
- }
-
- table->mc_promisc_last = false;
table->vlan_filter =
!!(efx->net_dev->features & NETIF_F_HW_VLAN_CTAG_FILTER);
- INIT_LIST_HEAD(&table->vlan_list);
- init_rwsem(&table->lock);
-
- efx->filter_state = table;

return 0;
-fail:
+
+fail2:
+ vfree(table->entry);
+fail1:
kfree(table);
+ efx->filter_state = NULL;
return rc;
}

diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index fcd51d3992fa..3dc9eae5a81d 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -646,6 +646,7 @@ enum nic_state {
STATE_NET_DOWN, /* netdev registered */
STATE_NET_UP, /* ready for traffic */
STATE_DISABLED, /* device disabled due to hardware errors */
+ STATE_VDPA, /* device bar_config changed to vDPA */

STATE_RECOVERY = 0x100,/* recovering from PCI error */
STATE_FROZEN = 0x200, /* frozen by power management */
--
2.30.1


2023-03-07 11:40:49

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 09/14] sfc: implement device status related vdpa config operations

vDPA config opertions to handle get/set device status and device
reset have been implemented. Also .suspend config operation is
implemented to support Live Migration.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/ef100_vdpa.c | 16 +-
drivers/net/ethernet/sfc/ef100_vdpa.h | 2 +
drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 367 ++++++++++++++++++++--
3 files changed, 355 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
index c66e5aef69ea..4ba57827a6cd 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
@@ -68,9 +68,14 @@ static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)

static void ef100_vdpa_delete(struct efx_nic *efx)
{
+ struct vdpa_device *vdpa_dev;
+
if (efx->vdpa_nic) {
+ vdpa_dev = &efx->vdpa_nic->vdpa_dev;
+ ef100_vdpa_reset(vdpa_dev);
+
/* replace with _vdpa_unregister_device later */
- put_device(&efx->vdpa_nic->vdpa_dev.dev);
+ put_device(&vdpa_dev->dev);
}
efx_mcdi_free_vis(efx);
}
@@ -171,6 +176,15 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
}
}

+ rc = devm_add_action_or_reset(&efx->pci_dev->dev,
+ ef100_vdpa_irq_vectors_free,
+ efx->pci_dev);
+ if (rc) {
+ pci_err(efx->pci_dev,
+ "Failed adding devres for freeing irq vectors\n");
+ goto err_put_device;
+ }
+
rc = get_net_config(vdpa_nic);
if (rc)
goto err_put_device;
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
index 348ca8a7404b..58791402e454 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.h
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
@@ -149,6 +149,8 @@ int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
void ef100_vdpa_irq_vectors_free(void *data);
int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
+void ef100_vdpa_irq_vectors_free(void *data);
+int ef100_vdpa_reset(struct vdpa_device *vdev);

static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
{
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
index 0051c4c0e47c..95a2177f85a2 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
@@ -22,11 +22,6 @@ static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
}

-void ef100_vdpa_irq_vectors_free(void *data)
-{
- pci_free_irq_vectors(data);
-}
-
static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
{
struct efx_vring_ctx *vring_ctx;
@@ -52,14 +47,6 @@ static void delete_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
vdpa_nic->vring[idx].vring_ctx = NULL;
}

-static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
-{
- vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
- vdpa_nic->vring[idx].vring_state = 0;
- vdpa_nic->vring[idx].last_avail_idx = 0;
- vdpa_nic->vring[idx].last_used_idx = 0;
-}
-
int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
{
u32 offset;
@@ -103,6 +90,236 @@ static bool is_qid_invalid(struct ef100_vdpa_nic *vdpa_nic, u16 idx,
return false;
}

+static void irq_vring_fini(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
+{
+ struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
+ struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
+
+ devm_free_irq(&pci_dev->dev, vring->irq, vring);
+ vring->irq = -EINVAL;
+}
+
+static irqreturn_t vring_intr_handler(int irq, void *arg)
+{
+ struct ef100_vdpa_vring_info *vring = arg;
+
+ if (vring->cb.callback)
+ return vring->cb.callback(vring->cb.private);
+
+ return IRQ_NONE;
+}
+
+static int ef100_vdpa_irq_vectors_alloc(struct pci_dev *pci_dev, u16 nvqs)
+{
+ int rc;
+
+ rc = pci_alloc_irq_vectors(pci_dev, nvqs, nvqs, PCI_IRQ_MSIX);
+ if (rc < 0)
+ pci_err(pci_dev,
+ "Failed to alloc %d IRQ vectors, err:%d\n", nvqs, rc);
+ return rc;
+}
+
+void ef100_vdpa_irq_vectors_free(void *data)
+{
+ pci_free_irq_vectors(data);
+}
+
+static int irq_vring_init(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
+{
+ struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
+ struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
+ int irq;
+ int rc;
+
+ snprintf(vring->msix_name, 256, "x_vdpa[%s]-%d\n",
+ pci_name(pci_dev), idx);
+ irq = pci_irq_vector(pci_dev, idx);
+ rc = devm_request_irq(&pci_dev->dev, irq, vring_intr_handler, 0,
+ vring->msix_name, vring);
+ if (rc)
+ pci_err(pci_dev,
+ "devm_request_irq failed for vring %d, rc %d\n",
+ idx, rc);
+ else
+ vring->irq = irq;
+
+ return rc;
+}
+
+static int delete_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
+{
+ struct efx_vring_dyn_cfg vring_dyn_cfg;
+ int rc;
+
+ if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
+ return 0;
+
+ rc = efx_vdpa_vring_destroy(vdpa_nic->vring[idx].vring_ctx,
+ &vring_dyn_cfg);
+ if (rc)
+ dev_err(&vdpa_nic->vdpa_dev.dev,
+ "%s: delete vring failed index:%u, err:%d\n",
+ __func__, idx, rc);
+ vdpa_nic->vring[idx].last_avail_idx = vring_dyn_cfg.avail_idx;
+ vdpa_nic->vring[idx].last_used_idx = vring_dyn_cfg.used_idx;
+ vdpa_nic->vring[idx].vring_state &= ~EF100_VRING_CREATED;
+
+ irq_vring_fini(vdpa_nic, idx);
+
+ return rc;
+}
+
+static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ u32 idx_val;
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ return;
+
+ if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
+ return;
+
+ idx_val = idx;
+ _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
+ vdpa_nic->vring[idx].doorbell_offset);
+}
+
+static bool can_create_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
+{
+ if (vdpa_nic->vring[idx].vring_state == EF100_VRING_CONFIGURED &&
+ vdpa_nic->status & VIRTIO_CONFIG_S_DRIVER_OK &&
+ !(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
+ return true;
+
+ return false;
+}
+
+static int create_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
+{
+ struct efx_vring_dyn_cfg vring_dyn_cfg;
+ struct efx_vring_cfg vring_cfg;
+ int rc;
+
+ rc = irq_vring_init(vdpa_nic, idx);
+ if (rc) {
+ dev_err(&vdpa_nic->vdpa_dev.dev,
+ "%s: irq_vring_init failed. index:%u, err:%d\n",
+ __func__, idx, rc);
+ return rc;
+ }
+ vring_cfg.desc = vdpa_nic->vring[idx].desc;
+ vring_cfg.avail = vdpa_nic->vring[idx].avail;
+ vring_cfg.used = vdpa_nic->vring[idx].used;
+ vring_cfg.size = vdpa_nic->vring[idx].size;
+ vring_cfg.features = vdpa_nic->features;
+ vring_cfg.msix_vector = idx;
+ vring_dyn_cfg.avail_idx = vdpa_nic->vring[idx].last_avail_idx;
+ vring_dyn_cfg.used_idx = vdpa_nic->vring[idx].last_used_idx;
+
+ rc = efx_vdpa_vring_create(vdpa_nic->vring[idx].vring_ctx,
+ &vring_cfg, &vring_dyn_cfg);
+ if (rc) {
+ dev_err(&vdpa_nic->vdpa_dev.dev,
+ "%s: vring_create failed index:%u, err:%d\n",
+ __func__, idx, rc);
+ goto err_vring_create;
+ }
+ vdpa_nic->vring[idx].vring_state |= EF100_VRING_CREATED;
+
+ /* A VQ kick allows the device to read the avail_idx, which will be
+ * required at the destination after live migration.
+ */
+ ef100_vdpa_kick_vq(&vdpa_nic->vdpa_dev, idx);
+
+ return 0;
+
+err_vring_create:
+ irq_vring_fini(vdpa_nic, idx);
+ return rc;
+}
+
+static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
+{
+ delete_vring(vdpa_nic, idx);
+ vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
+ vdpa_nic->vring[idx].vring_state = 0;
+ vdpa_nic->vring[idx].last_avail_idx = 0;
+ vdpa_nic->vring[idx].last_used_idx = 0;
+}
+
+static void ef100_reset_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
+{
+ int i;
+
+ WARN_ON(!mutex_is_locked(&vdpa_nic->lock));
+
+ if (!vdpa_nic->status)
+ return;
+
+ vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
+ vdpa_nic->status = 0;
+ vdpa_nic->features = 0;
+ for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++)
+ reset_vring(vdpa_nic, i);
+ ef100_vdpa_irq_vectors_free(vdpa_nic->efx->pci_dev);
+}
+
+/* May be called under the rtnl lock */
+int ef100_vdpa_reset(struct vdpa_device *vdev)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ /* vdpa device can be deleted anytime but the bar_config
+ * could still be vdpa and hence efx->state would be STATE_VDPA.
+ * Accordingly, ensure vdpa device exists before reset handling
+ */
+ if (!vdpa_nic)
+ return -ENODEV;
+
+ mutex_lock(&vdpa_nic->lock);
+ ef100_reset_vdpa_device(vdpa_nic);
+ mutex_unlock(&vdpa_nic->lock);
+ return 0;
+}
+
+static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
+{
+ struct efx_nic *efx = vdpa_nic->efx;
+ struct ef100_nic_data *nic_data;
+ int i, j;
+ int rc;
+
+ nic_data = efx->nic_data;
+ rc = ef100_vdpa_irq_vectors_alloc(efx->pci_dev,
+ vdpa_nic->max_queue_pairs * 2);
+ if (rc < 0) {
+ pci_err(efx->pci_dev,
+ "vDPA IRQ alloc failed for vf: %u err:%d\n",
+ nic_data->vf_index, rc);
+ return rc;
+ }
+
+ for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
+ if (can_create_vring(vdpa_nic, i)) {
+ rc = create_vring(vdpa_nic, i);
+ if (rc)
+ goto clear_vring;
+ }
+ }
+
+ vdpa_nic->vdpa_state = EF100_VDPA_STATE_STARTED;
+ return 0;
+
+clear_vring:
+ for (j = 0; j < i; j++)
+ delete_vring(vdpa_nic, j);
+
+ ef100_vdpa_irq_vectors_free(efx->pci_dev);
+ return rc;
+}
+
static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
u16 idx, u64 desc_area, u64 driver_area,
u64 device_area)
@@ -144,22 +361,6 @@ static void ef100_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
mutex_unlock(&vdpa_nic->lock);
}

-static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
-{
- struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
- u32 idx_val;
-
- if (is_qid_invalid(vdpa_nic, idx, __func__))
- return;
-
- if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
- return;
-
- idx_val = idx;
- _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
- vdpa_nic->vring[idx].doorbell_offset);
-}
-
static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
struct vdpa_callback *cb)
{
@@ -176,6 +377,7 @@ static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
bool ready)
{
struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ int rc;

if (is_qid_invalid(vdpa_nic, idx, __func__))
return;
@@ -184,9 +386,21 @@ static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
if (ready) {
vdpa_nic->vring[idx].vring_state |=
EF100_VRING_READY_CONFIGURED;
+ if (vdpa_nic->vdpa_state == EF100_VDPA_STATE_STARTED &&
+ can_create_vring(vdpa_nic, idx)) {
+ rc = create_vring(vdpa_nic, idx);
+ if (rc)
+ /* Rollback ready configuration
+ * So that the above layer driver
+ * can make another attempt to set ready
+ */
+ vdpa_nic->vring[idx].vring_state &=
+ ~EF100_VRING_READY_CONFIGURED;
+ }
} else {
vdpa_nic->vring[idx].vring_state &=
~EF100_VRING_READY_CONFIGURED;
+ delete_vring(vdpa_nic, idx);
}
mutex_unlock(&vdpa_nic->lock);
}
@@ -296,6 +510,12 @@ static u64 ef100_vdpa_get_device_features(struct vdpa_device *vdev)
}

features |= BIT_ULL(VIRTIO_NET_F_MAC);
+ /* As QEMU SVQ doesn't implement the following features,
+ * masking them off to allow Live Migration
+ */
+ features &= ~BIT_ULL(VIRTIO_F_IN_ORDER);
+ features &= ~BIT_ULL(VIRTIO_F_ORDER_PLATFORM);
+
return features;
}

@@ -356,6 +576,77 @@ static u32 ef100_vdpa_get_vendor_id(struct vdpa_device *vdev)
return EF100_VDPA_VENDOR_ID;
}

+static u8 ef100_vdpa_get_status(struct vdpa_device *vdev)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ u8 status;
+
+ mutex_lock(&vdpa_nic->lock);
+ status = vdpa_nic->status;
+ mutex_unlock(&vdpa_nic->lock);
+ return status;
+}
+
+static void ef100_vdpa_set_status(struct vdpa_device *vdev, u8 status)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ u8 new_status;
+ int rc;
+
+ mutex_lock(&vdpa_nic->lock);
+ if (!status) {
+ dev_info(&vdev->dev,
+ "%s: Status received is 0. Device reset being done\n",
+ __func__);
+ ef100_reset_vdpa_device(vdpa_nic);
+ goto unlock_return;
+ }
+ new_status = status & ~vdpa_nic->status;
+ if (new_status == 0) {
+ dev_info(&vdev->dev,
+ "%s: New status same as current status\n", __func__);
+ goto unlock_return;
+ }
+ if (new_status & VIRTIO_CONFIG_S_FAILED) {
+ ef100_reset_vdpa_device(vdpa_nic);
+ goto unlock_return;
+ }
+
+ if (new_status & VIRTIO_CONFIG_S_ACKNOWLEDGE) {
+ vdpa_nic->status |= VIRTIO_CONFIG_S_ACKNOWLEDGE;
+ new_status &= ~VIRTIO_CONFIG_S_ACKNOWLEDGE;
+ }
+ if (new_status & VIRTIO_CONFIG_S_DRIVER) {
+ vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER;
+ new_status &= ~VIRTIO_CONFIG_S_DRIVER;
+ }
+ if (new_status & VIRTIO_CONFIG_S_FEATURES_OK) {
+ vdpa_nic->status |= VIRTIO_CONFIG_S_FEATURES_OK;
+ vdpa_nic->vdpa_state = EF100_VDPA_STATE_NEGOTIATED;
+ new_status &= ~VIRTIO_CONFIG_S_FEATURES_OK;
+ }
+ if (new_status & VIRTIO_CONFIG_S_DRIVER_OK &&
+ vdpa_nic->vdpa_state == EF100_VDPA_STATE_NEGOTIATED) {
+ vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER_OK;
+ rc = start_vdpa_device(vdpa_nic);
+ if (rc) {
+ dev_err(&vdpa_nic->vdpa_dev.dev,
+ "%s: vDPA device failed:%d\n", __func__, rc);
+ vdpa_nic->status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
+ goto unlock_return;
+ }
+ new_status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
+ }
+ if (new_status) {
+ dev_warn(&vdev->dev,
+ "%s: Mismatch Status: %x & State: %u\n",
+ __func__, new_status, vdpa_nic->vdpa_state);
+ }
+
+unlock_return:
+ mutex_unlock(&vdpa_nic->lock);
+}
+
static size_t ef100_vdpa_get_config_size(struct vdpa_device *vdev)
{
return sizeof(struct virtio_net_config);
@@ -393,6 +684,20 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
vdpa_nic->mac_configured = true;
}

+static int ef100_vdpa_suspend(struct vdpa_device *vdev)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ int i, rc;
+
+ mutex_lock(&vdpa_nic->lock);
+ for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
+ rc = delete_vring(vdpa_nic, i);
+ if (rc)
+ break;
+ }
+ mutex_unlock(&vdpa_nic->lock);
+ return rc;
+}
static void ef100_vdpa_free(struct vdpa_device *vdev)
{
struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
@@ -428,9 +733,13 @@ const struct vdpa_config_ops ef100_vdpa_config_ops = {
.get_vq_num_max = ef100_vdpa_get_vq_num_max,
.get_device_id = ef100_vdpa_get_device_id,
.get_vendor_id = ef100_vdpa_get_vendor_id,
+ .get_status = ef100_vdpa_get_status,
+ .set_status = ef100_vdpa_set_status,
+ .reset = ef100_vdpa_reset,
.get_config_size = ef100_vdpa_get_config_size,
.get_config = ef100_vdpa_get_config,
.set_config = ef100_vdpa_set_config,
.get_generation = NULL,
+ .suspend = ef100_vdpa_suspend,
.free = ef100_vdpa_free,
};
--
2.30.1


2023-03-07 11:40:54

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 08/14] sfc: implement vdpa vring config operations

This patch implements the vDPA config operations related to
virtqueues or vrings. These include setting vring address,
getting vq state, operations to enable/disable a vq etc.
The resources required for vring operations eg. VI, interrupts etc.
are also allocated.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/ef100_vdpa.c | 46 +++-
drivers/net/ethernet/sfc/ef100_vdpa.h | 54 +++++
drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 275 ++++++++++++++++++++++
3 files changed, 374 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
index 4c5a98c9d6c3..c66e5aef69ea 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
@@ -14,6 +14,7 @@
#include "ef100_vdpa.h"
#include "mcdi_vdpa.h"
#include "mcdi_filters.h"
+#include "mcdi_functions.h"
#include "ef100_netdev.h"

static struct virtio_device_id ef100_vdpa_id_table[] = {
@@ -47,12 +48,31 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data)
return rc;
}

+static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)
+{
+ /* The first VI is reserved for MCDI
+ * 1 VI each for rx + tx ring
+ */
+ unsigned int max_vis = 1 + EF100_VDPA_MAX_QUEUES_PAIRS;
+ unsigned int min_vis = 1 + 1;
+ int rc;
+
+ rc = efx_mcdi_alloc_vis(efx, min_vis, max_vis,
+ NULL, allocated_vis);
+ if (!rc)
+ return rc;
+ if (*allocated_vis < min_vis)
+ return -ENOSPC;
+ return 0;
+}
+
static void ef100_vdpa_delete(struct efx_nic *efx)
{
if (efx->vdpa_nic) {
/* replace with _vdpa_unregister_device later */
put_device(&efx->vdpa_nic->vdpa_dev.dev);
}
+ efx_mcdi_free_vis(efx);
}

void ef100_vdpa_fini(struct efx_probe_data *probe_data)
@@ -104,9 +124,19 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
{
struct ef100_nic_data *nic_data = efx->nic_data;
struct ef100_vdpa_nic *vdpa_nic;
+ unsigned int allocated_vis;
int rc;
+ u8 i;

nic_data->vdpa_class = dev_type;
+ rc = vdpa_allocate_vis(efx, &allocated_vis);
+ if (rc) {
+ pci_err(efx->pci_dev,
+ "%s Alloc VIs failed for vf:%u error:%d\n",
+ __func__, nic_data->vf_index, rc);
+ return ERR_PTR(rc);
+ }
+
vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
vdpa_dev, &efx->pci_dev->dev,
&ef100_vdpa_config_ops,
@@ -117,7 +147,8 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
"vDPA device allocation failed for vf: %u\n",
nic_data->vf_index);
nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
- return ERR_PTR(-ENOMEM);
+ rc = -ENOMEM;
+ goto err_alloc_vis_free;
}

mutex_init(&vdpa_nic->lock);
@@ -125,11 +156,21 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
vdpa_nic->efx = efx;
+ vdpa_nic->max_queue_pairs = allocated_vis - 1;
vdpa_nic->pf_index = nic_data->pf_index;
vdpa_nic->vf_index = nic_data->vf_index;
vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;

+ for (i = 0; i < (2 * vdpa_nic->max_queue_pairs); i++) {
+ rc = ef100_vdpa_init_vring(vdpa_nic, i);
+ if (rc) {
+ pci_err(efx->pci_dev,
+ "vring init idx: %u failed, rc: %d\n", i, rc);
+ goto err_put_device;
+ }
+ }
+
rc = get_net_config(vdpa_nic);
if (rc)
goto err_put_device;
@@ -146,6 +187,9 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
err_put_device:
/* put_device invokes ef100_vdpa_free */
put_device(&vdpa_nic->vdpa_dev.dev);
+
+err_alloc_vis_free:
+ efx_mcdi_free_vis(efx);
return ERR_PTR(rc);
}

diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
index dcf4a8156415..348ca8a7404b 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.h
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
@@ -32,6 +32,21 @@
/* Alignment requirement of the Virtqueue */
#define EF100_VDPA_VQ_ALIGN 4096

+/* Vring configuration definitions */
+#define EF100_VRING_ADDRESS_CONFIGURED 0x1
+#define EF100_VRING_SIZE_CONFIGURED 0x10
+#define EF100_VRING_READY_CONFIGURED 0x100
+#define EF100_VRING_CONFIGURED (EF100_VRING_ADDRESS_CONFIGURED | \
+ EF100_VRING_SIZE_CONFIGURED | \
+ EF100_VRING_READY_CONFIGURED)
+#define EF100_VRING_CREATED 0x1000
+
+/* Maximum size of msix name */
+#define EF100_VDPA_MAX_MSIX_NAME_SIZE 256
+
+/* Default high IOVA for MCDI buffer */
+#define EF100_VDPA_IOVA_BASE_ADDR 0x20000000000
+
/**
* enum ef100_vdpa_nic_state - possible states for a vDPA NIC
*
@@ -57,6 +72,41 @@ enum ef100_vdpa_vq_type {
EF100_VDPA_VQ_NTYPES
};

+/**
+ * struct ef100_vdpa_vring_info - vDPA vring data structure
+ *
+ * @desc: Descriptor area address of the vring
+ * @avail: Available area address of the vring
+ * @used: Device area address of the vring
+ * @size: Number of entries in the vring
+ * @vring_state: bit map to track vring configuration
+ * @last_avail_idx: last available index of the vring
+ * @last_used_idx: last used index of the vring
+ * @doorbell_offset: doorbell offset
+ * @doorbell_offset_valid: true if @doorbell_offset is updated
+ * @vring_type: type of vring created
+ * @vring_ctx: vring context information
+ * @msix_name: device name for vring irq handler
+ * @irq: irq number for vring irq handler
+ * @cb: callback for vring interrupts
+ */
+struct ef100_vdpa_vring_info {
+ dma_addr_t desc;
+ dma_addr_t avail;
+ dma_addr_t used;
+ u32 size;
+ u16 vring_state;
+ u32 last_avail_idx;
+ u32 last_used_idx;
+ u32 doorbell_offset;
+ bool doorbell_offset_valid;
+ enum ef100_vdpa_vq_type vring_type;
+ struct efx_vring_ctx *vring_ctx;
+ char msix_name[EF100_VDPA_MAX_MSIX_NAME_SIZE];
+ u32 irq;
+ struct vdpa_callback cb;
+};
+
/**
* struct ef100_vdpa_nic - vDPA NIC data structure
*
@@ -70,6 +120,7 @@ enum ef100_vdpa_vq_type {
* @features: negotiated feature bits
* @max_queue_pairs: maximum number of queue pairs supported
* @net_config: virtio_net_config data
+ * @vring: vring information of the vDPA device.
* @mac_address: mac address of interface associated with this vdpa device
* @mac_configured: true after MAC address is configured
* @cfg_cb: callback for config change
@@ -86,6 +137,7 @@ struct ef100_vdpa_nic {
u64 features;
u32 max_queue_pairs;
struct virtio_net_config net_config;
+ struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
u8 *mac_address;
bool mac_configured;
struct vdpa_callback cfg_cb;
@@ -95,6 +147,8 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data);
void ef100_vdpa_fini(struct efx_probe_data *probe_data);
int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
+void ef100_vdpa_irq_vectors_free(void *data);
+int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);

static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
{
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
index a2364ef9f492..0051c4c0e47c 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
@@ -9,13 +9,270 @@

#include <linux/vdpa.h>
#include "ef100_vdpa.h"
+#include "io.h"
#include "mcdi_vdpa.h"

+/* Get the queue's function-local index of the associated VI
+ * virtqueue number queue 0 is reserved for MCDI
+ */
+#define EFX_GET_VI_INDEX(vq_num) (((vq_num) / 2) + 1)
+
static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
{
return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
}

+void ef100_vdpa_irq_vectors_free(void *data)
+{
+ pci_free_irq_vectors(data);
+}
+
+static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
+{
+ struct efx_vring_ctx *vring_ctx;
+ u32 vi_index;
+
+ if (idx % 2) /* Even VQ for RX and odd for TX */
+ vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_TYPE_NET_TXQ;
+ else
+ vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_TYPE_NET_RXQ;
+ vi_index = EFX_GET_VI_INDEX(idx);
+ vring_ctx = efx_vdpa_vring_init(vdpa_nic->efx, vi_index,
+ vdpa_nic->vring[idx].vring_type);
+ if (IS_ERR(vring_ctx))
+ return PTR_ERR(vring_ctx);
+
+ vdpa_nic->vring[idx].vring_ctx = vring_ctx;
+ return 0;
+}
+
+static void delete_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
+{
+ efx_vdpa_vring_fini(vdpa_nic->vring[idx].vring_ctx);
+ vdpa_nic->vring[idx].vring_ctx = NULL;
+}
+
+static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
+{
+ vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
+ vdpa_nic->vring[idx].vring_state = 0;
+ vdpa_nic->vring[idx].last_avail_idx = 0;
+ vdpa_nic->vring[idx].last_used_idx = 0;
+}
+
+int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
+{
+ u32 offset;
+ int rc;
+
+ vdpa_nic->vring[idx].irq = -EINVAL;
+ rc = create_vring_ctx(vdpa_nic, idx);
+ if (rc) {
+ dev_err(&vdpa_nic->vdpa_dev.dev,
+ "%s: create_vring_ctx failed, idx:%u, err:%d\n",
+ __func__, idx, rc);
+ return rc;
+ }
+
+ rc = efx_vdpa_get_doorbell_offset(vdpa_nic->vring[idx].vring_ctx,
+ &offset);
+ if (rc) {
+ dev_err(&vdpa_nic->vdpa_dev.dev,
+ "%s: get_doorbell failed idx:%u, err:%d\n",
+ __func__, idx, rc);
+ goto err_get_doorbell_offset;
+ }
+ vdpa_nic->vring[idx].doorbell_offset = offset;
+ vdpa_nic->vring[idx].doorbell_offset_valid = true;
+
+ return 0;
+
+err_get_doorbell_offset:
+ delete_vring_ctx(vdpa_nic, idx);
+ return rc;
+}
+
+static bool is_qid_invalid(struct ef100_vdpa_nic *vdpa_nic, u16 idx,
+ const char *caller)
+{
+ if (unlikely(idx >= (vdpa_nic->max_queue_pairs * 2))) {
+ dev_err(&vdpa_nic->vdpa_dev.dev,
+ "%s: Invalid qid %u\n", caller, idx);
+ return true;
+ }
+ return false;
+}
+
+static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
+ u16 idx, u64 desc_area, u64 driver_area,
+ u64 device_area)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ return -EINVAL;
+
+ mutex_lock(&vdpa_nic->lock);
+ vdpa_nic->vring[idx].desc = desc_area;
+ vdpa_nic->vring[idx].avail = driver_area;
+ vdpa_nic->vring[idx].used = device_area;
+ vdpa_nic->vring[idx].vring_state |= EF100_VRING_ADDRESS_CONFIGURED;
+ mutex_unlock(&vdpa_nic->lock);
+ return 0;
+}
+
+static void ef100_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ return;
+
+ if (!is_power_of_2(num)) {
+ dev_err(&vdev->dev, "%s: Index:%u size:%u not power of 2\n",
+ __func__, idx, num);
+ return;
+ }
+ if (num > EF100_VDPA_VQ_NUM_MAX_SIZE) {
+ dev_err(&vdev->dev, "%s: Index:%u size:%u more than max:%u\n",
+ __func__, idx, num, EF100_VDPA_VQ_NUM_MAX_SIZE);
+ return;
+ }
+ mutex_lock(&vdpa_nic->lock);
+ vdpa_nic->vring[idx].size = num;
+ vdpa_nic->vring[idx].vring_state |= EF100_VRING_SIZE_CONFIGURED;
+ mutex_unlock(&vdpa_nic->lock);
+}
+
+static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ u32 idx_val;
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ return;
+
+ if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
+ return;
+
+ idx_val = idx;
+ _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
+ vdpa_nic->vring[idx].doorbell_offset);
+}
+
+static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
+ struct vdpa_callback *cb)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ return;
+
+ if (cb)
+ vdpa_nic->vring[idx].cb = *cb;
+}
+
+static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
+ bool ready)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ return;
+
+ mutex_lock(&vdpa_nic->lock);
+ if (ready) {
+ vdpa_nic->vring[idx].vring_state |=
+ EF100_VRING_READY_CONFIGURED;
+ } else {
+ vdpa_nic->vring[idx].vring_state &=
+ ~EF100_VRING_READY_CONFIGURED;
+ }
+ mutex_unlock(&vdpa_nic->lock);
+}
+
+static bool ef100_vdpa_get_vq_ready(struct vdpa_device *vdev, u16 idx)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ bool ready;
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ return false;
+
+ mutex_lock(&vdpa_nic->lock);
+ ready = vdpa_nic->vring[idx].vring_state & EF100_VRING_READY_CONFIGURED;
+ mutex_unlock(&vdpa_nic->lock);
+ return ready;
+}
+
+static int ef100_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx,
+ const struct vdpa_vq_state *state)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ return -EINVAL;
+
+ mutex_lock(&vdpa_nic->lock);
+ vdpa_nic->vring[idx].last_avail_idx = state->split.avail_index;
+ vdpa_nic->vring[idx].last_used_idx = state->split.avail_index;
+ mutex_unlock(&vdpa_nic->lock);
+ return 0;
+}
+
+static int ef100_vdpa_get_vq_state(struct vdpa_device *vdev,
+ u16 idx, struct vdpa_vq_state *state)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ return -EINVAL;
+
+ mutex_lock(&vdpa_nic->lock);
+ state->split.avail_index = (u16)vdpa_nic->vring[idx].last_used_idx;
+ mutex_unlock(&vdpa_nic->lock);
+
+ return 0;
+}
+
+static struct vdpa_notification_area
+ ef100_vdpa_get_vq_notification(struct vdpa_device *vdev,
+ u16 idx)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ struct vdpa_notification_area notify_area = {0, 0};
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ goto end;
+
+ mutex_lock(&vdpa_nic->lock);
+ notify_area.addr = (uintptr_t)(vdpa_nic->efx->membase_phys +
+ vdpa_nic->vring[idx].doorbell_offset);
+ /* VDPA doorbells are at a stride of VI/2
+ * One VI stride is shared by both rx & tx doorbells
+ */
+ notify_area.size = vdpa_nic->efx->vi_stride / 2;
+ mutex_unlock(&vdpa_nic->lock);
+
+end:
+ return notify_area;
+}
+
+static int ef100_get_vq_irq(struct vdpa_device *vdev, u16 idx)
+{
+ struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ u32 irq;
+
+ if (is_qid_invalid(vdpa_nic, idx, __func__))
+ return -EINVAL;
+
+ mutex_lock(&vdpa_nic->lock);
+ irq = vdpa_nic->vring[idx].irq;
+ mutex_unlock(&vdpa_nic->lock);
+
+ return irq;
+}
+
static u32 ef100_vdpa_get_vq_align(struct vdpa_device *vdev)
{
return EF100_VDPA_VQ_ALIGN;
@@ -80,6 +337,8 @@ static void ef100_vdpa_set_config_cb(struct vdpa_device *vdev,

if (cb)
vdpa_nic->cfg_cb = *cb;
+ else
+ memset(&vdpa_nic->cfg_cb, 0, sizeof(vdpa_nic->cfg_cb));
}

static u16 ef100_vdpa_get_vq_num_max(struct vdpa_device *vdev)
@@ -137,14 +396,30 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
static void ef100_vdpa_free(struct vdpa_device *vdev)
{
struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ int i;

if (vdpa_nic) {
+ for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
+ reset_vring(vdpa_nic, i);
+ if (vdpa_nic->vring[i].vring_ctx)
+ delete_vring_ctx(vdpa_nic, i);
+ }
mutex_destroy(&vdpa_nic->lock);
vdpa_nic->efx->vdpa_nic = NULL;
}
}

const struct vdpa_config_ops ef100_vdpa_config_ops = {
+ .set_vq_address = ef100_vdpa_set_vq_address,
+ .set_vq_num = ef100_vdpa_set_vq_num,
+ .kick_vq = ef100_vdpa_kick_vq,
+ .set_vq_cb = ef100_vdpa_set_vq_cb,
+ .set_vq_ready = ef100_vdpa_set_vq_ready,
+ .get_vq_ready = ef100_vdpa_get_vq_ready,
+ .set_vq_state = ef100_vdpa_set_vq_state,
+ .get_vq_state = ef100_vdpa_get_vq_state,
+ .get_vq_notification = ef100_vdpa_get_vq_notification,
+ .get_vq_irq = ef100_get_vq_irq,
.get_vq_align = ef100_vdpa_get_vq_align,
.get_device_features = ef100_vdpa_get_device_features,
.set_driver_features = ef100_vdpa_set_driver_features,
--
2.30.1


2023-03-07 11:41:54

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 10/14] sfc: implement filters for receiving traffic

Implement unicast, broadcast and unknown multicast
filters for receiving different types of traffic.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/ef100_vdpa.c | 157 ++++++++++++++++++++++
drivers/net/ethernet/sfc/ef100_vdpa.h | 36 ++++-
drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 17 ++-
3 files changed, 207 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
index 4ba57827a6cd..5c9f29f881a6 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
@@ -16,12 +16,166 @@
#include "mcdi_filters.h"
#include "mcdi_functions.h"
#include "ef100_netdev.h"
+#include "filter.h"
+#include "efx.h"

+#define EFX_INVALID_FILTER_ID -1
+
+/* vDPA queues starts from 2nd VI or qid 1 */
+#define EF100_VDPA_BASE_RX_QID 1
+
+static const char * const filter_names[] = { "bcast", "ucast", "mcast" };
static struct virtio_device_id ef100_vdpa_id_table[] = {
{ .device = VIRTIO_ID_NET, .vendor = PCI_VENDOR_ID_REDHAT_QUMRANET },
{ 0 },
};

+static int ef100_vdpa_set_mac_filter(struct efx_nic *efx,
+ struct efx_filter_spec *spec,
+ u32 qid, u8 *mac_addr)
+{
+ int rc;
+
+ efx_filter_init_rx(spec, EFX_FILTER_PRI_AUTO, 0, qid);
+
+ if (mac_addr) {
+ rc = efx_filter_set_eth_local(spec, EFX_FILTER_VID_UNSPEC,
+ mac_addr);
+ if (rc)
+ pci_err(efx->pci_dev,
+ "Filter set eth local failed, err: %d\n", rc);
+ } else {
+ efx_filter_set_mc_def(spec);
+ }
+
+ rc = efx_filter_insert_filter(efx, spec, true);
+ if (rc < 0)
+ pci_err(efx->pci_dev,
+ "Filter insert failed, err: %d\n", rc);
+
+ return rc;
+}
+
+static int ef100_vdpa_delete_filter(struct ef100_vdpa_nic *vdpa_nic,
+ enum ef100_vdpa_mac_filter_type type)
+{
+ struct vdpa_device *vdev = &vdpa_nic->vdpa_dev;
+ int rc;
+
+ if (vdpa_nic->filters[type].filter_id == EFX_INVALID_FILTER_ID)
+ return rc;
+
+ rc = efx_filter_remove_id_safe(vdpa_nic->efx,
+ EFX_FILTER_PRI_AUTO,
+ vdpa_nic->filters[type].filter_id);
+ if (rc) {
+ dev_err(&vdev->dev, "%s filter id: %d remove failed, err: %d\n",
+ filter_names[type], vdpa_nic->filters[type].filter_id,
+ rc);
+ } else {
+ vdpa_nic->filters[type].filter_id = EFX_INVALID_FILTER_ID;
+ vdpa_nic->filter_cnt--;
+ }
+ return rc;
+}
+
+int ef100_vdpa_add_filter(struct ef100_vdpa_nic *vdpa_nic,
+ enum ef100_vdpa_mac_filter_type type)
+{
+ struct vdpa_device *vdev = &vdpa_nic->vdpa_dev;
+ struct efx_nic *efx = vdpa_nic->efx;
+ /* Configure filter on base Rx queue only */
+ u32 qid = EF100_VDPA_BASE_RX_QID;
+ struct efx_filter_spec *spec;
+ u8 baddr[ETH_ALEN];
+ int rc;
+
+ /* remove existing filter */
+ rc = ef100_vdpa_delete_filter(vdpa_nic, type);
+ if (rc < 0) {
+ dev_err(&vdev->dev, "%s MAC filter deletion failed, err: %d",
+ filter_names[type], rc);
+ return rc;
+ }
+
+ /* Configure MAC Filter */
+ spec = &vdpa_nic->filters[type].spec;
+ if (type == EF100_VDPA_BCAST_MAC_FILTER) {
+ eth_broadcast_addr(baddr);
+ rc = ef100_vdpa_set_mac_filter(efx, spec, qid, baddr);
+ } else if (type == EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER) {
+ rc = ef100_vdpa_set_mac_filter(efx, spec, qid, NULL);
+ } else {
+ /* Ensure we have a valid mac address */
+ if (!vdpa_nic->mac_configured ||
+ !is_valid_ether_addr(vdpa_nic->mac_address))
+ return -EINVAL;
+
+ rc = ef100_vdpa_set_mac_filter(efx, spec, qid,
+ vdpa_nic->mac_address);
+ }
+
+ if (rc >= 0) {
+ vdpa_nic->filters[type].filter_id = rc;
+ vdpa_nic->filter_cnt++;
+
+ return 0;
+ }
+
+ dev_err(&vdev->dev, "%s MAC filter insert failed, err: %d\n",
+ filter_names[type], rc);
+
+ if (type != EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER) {
+ ef100_vdpa_filter_remove(vdpa_nic);
+ return rc;
+ }
+
+ return 0;
+}
+
+int ef100_vdpa_filter_remove(struct ef100_vdpa_nic *vdpa_nic)
+{
+ enum ef100_vdpa_mac_filter_type filter;
+ int err = 0;
+ int rc;
+
+ for (filter = EF100_VDPA_BCAST_MAC_FILTER;
+ filter <= EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER; filter++) {
+ rc = ef100_vdpa_delete_filter(vdpa_nic, filter);
+ if (rc < 0)
+ /* store status of last failed filter remove */
+ err = rc;
+ }
+ return err;
+}
+
+int ef100_vdpa_filter_configure(struct ef100_vdpa_nic *vdpa_nic)
+{
+ struct vdpa_device *vdev = &vdpa_nic->vdpa_dev;
+ enum ef100_vdpa_mac_filter_type filter;
+ int rc;
+
+ /* remove existing filters, if any */
+ rc = ef100_vdpa_filter_remove(vdpa_nic);
+ if (rc < 0) {
+ dev_err(&vdev->dev,
+ "MAC filter deletion failed, err: %d", rc);
+ goto fail;
+ }
+
+ for (filter = EF100_VDPA_BCAST_MAC_FILTER;
+ filter <= EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER; filter++) {
+ if (filter == EF100_VDPA_UCAST_MAC_FILTER &&
+ !vdpa_nic->mac_configured)
+ continue;
+ rc = ef100_vdpa_add_filter(vdpa_nic, filter);
+ if (rc < 0)
+ goto fail;
+ }
+fail:
+ return rc;
+}
+
int ef100_vdpa_init(struct efx_probe_data *probe_data)
{
struct efx_nic *efx = &probe_data->efx;
@@ -185,6 +339,9 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
goto err_put_device;
}

+ for (i = 0; i < EF100_VDPA_MAC_FILTER_NTYPES; i++)
+ vdpa_nic->filters[i].filter_id = EFX_INVALID_FILTER_ID;
+
rc = get_net_config(vdpa_nic);
if (rc)
goto err_put_device;
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
index 58791402e454..49fb6be04eb3 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.h
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
@@ -72,6 +72,22 @@ enum ef100_vdpa_vq_type {
EF100_VDPA_VQ_NTYPES
};

+/**
+ * enum ef100_vdpa_mac_filter_type - vdpa filter types
+ *
+ * @EF100_VDPA_BCAST_MAC_FILTER: Broadcast MAC filter
+ * @EF100_VDPA_UCAST_MAC_FILTER: Unicast MAC filter
+ * @EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER: Unknown multicast MAC filter to allow
+ * IPv6 Neighbor Solicitation Message
+ * @EF100_VDPA_MAC_FILTER_NTYPES: Number of vDPA filter types
+ */
+enum ef100_vdpa_mac_filter_type {
+ EF100_VDPA_BCAST_MAC_FILTER,
+ EF100_VDPA_UCAST_MAC_FILTER,
+ EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER,
+ EF100_VDPA_MAC_FILTER_NTYPES,
+};
+
/**
* struct ef100_vdpa_vring_info - vDPA vring data structure
*
@@ -107,6 +123,17 @@ struct ef100_vdpa_vring_info {
struct vdpa_callback cb;
};

+/**
+ * struct ef100_vdpa_filter - vDPA filter data structure
+ *
+ * @filter_id: filter id of this filter
+ * @efx_filter_spec: hardware filter specs for this vdpa device
+ */
+struct ef100_vdpa_filter {
+ s32 filter_id;
+ struct efx_filter_spec spec;
+};
+
/**
* struct ef100_vdpa_nic - vDPA NIC data structure
*
@@ -116,6 +143,7 @@ struct ef100_vdpa_vring_info {
* @lock: Managing access to vdpa config operations
* @pf_index: PF index of the vDPA VF
* @vf_index: VF index of the vDPA VF
+ * @filter_cnt: total number of filters created on this vdpa device
* @status: device status as per VIRTIO spec
* @features: negotiated feature bits
* @max_queue_pairs: maximum number of queue pairs supported
@@ -123,6 +151,7 @@ struct ef100_vdpa_vring_info {
* @vring: vring information of the vDPA device.
* @mac_address: mac address of interface associated with this vdpa device
* @mac_configured: true after MAC address is configured
+ * @filters: details of all filters created on this vdpa device
* @cfg_cb: callback for config change
*/
struct ef100_vdpa_nic {
@@ -133,6 +162,7 @@ struct ef100_vdpa_nic {
struct mutex lock;
u32 pf_index;
u32 vf_index;
+ u32 filter_cnt;
u8 status;
u64 features;
u32 max_queue_pairs;
@@ -140,6 +170,7 @@ struct ef100_vdpa_nic {
struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
u8 *mac_address;
bool mac_configured;
+ struct ef100_vdpa_filter filters[EF100_VDPA_MAC_FILTER_NTYPES];
struct vdpa_callback cfg_cb;
};

@@ -147,7 +178,10 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data);
void ef100_vdpa_fini(struct efx_probe_data *probe_data);
int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
-void ef100_vdpa_irq_vectors_free(void *data);
+int ef100_vdpa_filter_configure(struct ef100_vdpa_nic *vdpa_nic);
+int ef100_vdpa_filter_remove(struct ef100_vdpa_nic *vdpa_nic);
+int ef100_vdpa_add_filter(struct ef100_vdpa_nic *vdpa_nic,
+ enum ef100_vdpa_mac_filter_type type);
int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
void ef100_vdpa_irq_vectors_free(void *data);
int ef100_vdpa_reset(struct vdpa_device *vdev);
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
index 95a2177f85a2..db86c2693950 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
@@ -261,6 +261,7 @@ static void ef100_reset_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
vdpa_nic->status = 0;
vdpa_nic->features = 0;
+ ef100_vdpa_filter_remove(vdpa_nic);
for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++)
reset_vring(vdpa_nic, i);
ef100_vdpa_irq_vectors_free(vdpa_nic->efx->pci_dev);
@@ -295,7 +296,7 @@ static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
rc = ef100_vdpa_irq_vectors_alloc(efx->pci_dev,
vdpa_nic->max_queue_pairs * 2);
if (rc < 0) {
- pci_err(efx->pci_dev,
+ dev_err(&vdpa_nic->vdpa_dev.dev,
"vDPA IRQ alloc failed for vf: %u err:%d\n",
nic_data->vf_index, rc);
return rc;
@@ -309,9 +310,19 @@ static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
}
}

+ rc = ef100_vdpa_filter_configure(vdpa_nic);
+ if (rc < 0) {
+ dev_err(&vdpa_nic->vdpa_dev.dev,
+ "%s: vdpa configure filter failed, err: %d\n",
+ __func__, rc);
+ goto err_filter_configure;
+ }
+
vdpa_nic->vdpa_state = EF100_VDPA_STATE_STARTED;
return 0;

+err_filter_configure:
+ ef100_vdpa_filter_remove(vdpa_nic);
clear_vring:
for (j = 0; j < i; j++)
delete_vring(vdpa_nic, j);
@@ -680,8 +691,10 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
}

memcpy((u8 *)&vdpa_nic->net_config + offset, buf, len);
- if (is_valid_ether_addr(vdpa_nic->mac_address))
+ if (is_valid_ether_addr(vdpa_nic->mac_address)) {
vdpa_nic->mac_configured = true;
+ ef100_vdpa_add_filter(vdpa_nic, EF100_VDPA_UCAST_MAC_FILTER);
+ }
}

static int ef100_vdpa_suspend(struct vdpa_device *vdev)
--
2.30.1


2023-03-07 11:42:03

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 12/14] sfc: unmap VF's MCDI buffer when switching to vDPA mode

To avoid clash of IOVA range of VF's MCDI DMA buffer with the guest
buffer IOVAs, unmap the MCDI buffer when switching to vDPA mode
and use PF's IOMMU domain for running VF's MCDI commands.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/ef100_nic.c | 1 -
drivers/net/ethernet/sfc/ef100_vdpa.c | 25 ++++++++++++++++
drivers/net/ethernet/sfc/ef100_vdpa.h | 3 ++
drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 35 +++++++++++++++++++++++
drivers/net/ethernet/sfc/mcdi.h | 3 ++
drivers/net/ethernet/sfc/net_driver.h | 12 ++++++++
6 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
index cd9f724a9e64..1bffc1994ed8 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.c
+++ b/drivers/net/ethernet/sfc/ef100_nic.c
@@ -33,7 +33,6 @@

#define EF100_MAX_VIS 4096
#define EF100_NUM_MCDI_BUFFERS 1
-#define MCDI_BUF_LEN (8 + MCDI_CTL_SDU_LEN_MAX)

#define EF100_RESET_PORT ((ETH_RESET_MAC | ETH_RESET_PHY) << ETH_RESET_SHARED_SHIFT)

diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
index 5c9f29f881a6..30ca4ab00175 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
@@ -223,10 +223,19 @@ static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)
static void ef100_vdpa_delete(struct efx_nic *efx)
{
struct vdpa_device *vdpa_dev;
+ int rc;

if (efx->vdpa_nic) {
vdpa_dev = &efx->vdpa_nic->vdpa_dev;
ef100_vdpa_reset(vdpa_dev);
+ if (efx->mcdi_buf_mode == EFX_BUF_MODE_VDPA) {
+ rc = ef100_vdpa_map_mcdi_buffer(efx);
+ if (rc) {
+ pci_err(efx->pci_dev,
+ "map_mcdi_buffer failed, err: %d\n",
+ rc);
+ }
+ }

/* replace with _vdpa_unregister_device later */
put_device(&vdpa_dev->dev);
@@ -276,6 +285,21 @@ static int get_net_config(struct ef100_vdpa_nic *vdpa_nic)
return 0;
}

+static void unmap_mcdi_buffer(struct efx_nic *efx)
+{
+ struct ef100_nic_data *nic_data = efx->nic_data;
+ struct efx_mcdi_iface *mcdi;
+
+ mcdi = efx_mcdi(efx);
+ spin_lock_bh(&mcdi->iface_lock);
+ /* Save current MCDI mode to be restored later */
+ efx->vdpa_nic->mcdi_mode = mcdi->mode;
+ efx->mcdi_buf_mode = EFX_BUF_MODE_VDPA;
+ mcdi->mode = MCDI_MODE_FAIL;
+ spin_unlock_bh(&mcdi->iface_lock);
+ efx_nic_free_buffer(efx, &nic_data->mcdi_buf);
+}
+
static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
const char *dev_name,
enum ef100_vdpa_class dev_type,
@@ -342,6 +366,7 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
for (i = 0; i < EF100_VDPA_MAC_FILTER_NTYPES; i++)
vdpa_nic->filters[i].filter_id = EFX_INVALID_FILTER_ID;

+ unmap_mcdi_buffer(efx);
rc = get_net_config(vdpa_nic);
if (rc)
goto err_put_device;
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
index 49fb6be04eb3..0913ac2519cb 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.h
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
@@ -147,6 +147,7 @@ struct ef100_vdpa_filter {
* @status: device status as per VIRTIO spec
* @features: negotiated feature bits
* @max_queue_pairs: maximum number of queue pairs supported
+ * @mcdi_mode: MCDI mode at the time of unmapping VF mcdi buffer
* @net_config: virtio_net_config data
* @vring: vring information of the vDPA device.
* @mac_address: mac address of interface associated with this vdpa device
@@ -166,6 +167,7 @@ struct ef100_vdpa_nic {
u8 status;
u64 features;
u32 max_queue_pairs;
+ enum efx_mcdi_mode mcdi_mode;
struct virtio_net_config net_config;
struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
u8 *mac_address;
@@ -185,6 +187,7 @@ int ef100_vdpa_add_filter(struct ef100_vdpa_nic *vdpa_nic,
int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
void ef100_vdpa_irq_vectors_free(void *data);
int ef100_vdpa_reset(struct vdpa_device *vdev);
+int ef100_vdpa_map_mcdi_buffer(struct efx_nic *efx);

static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
{
diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
index db86c2693950..c6c9458f0e6f 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
@@ -711,12 +711,47 @@ static int ef100_vdpa_suspend(struct vdpa_device *vdev)
mutex_unlock(&vdpa_nic->lock);
return rc;
}
+
+int ef100_vdpa_map_mcdi_buffer(struct efx_nic *efx)
+{
+ struct ef100_nic_data *nic_data = efx->nic_data;
+ struct efx_mcdi_iface *mcdi;
+ int rc;
+
+ /* Update VF's MCDI buffer when switching out of vdpa mode */
+ rc = efx_nic_alloc_buffer(efx, &nic_data->mcdi_buf,
+ MCDI_BUF_LEN, GFP_KERNEL);
+ if (rc)
+ return rc;
+
+ mcdi = efx_mcdi(efx);
+ spin_lock_bh(&mcdi->iface_lock);
+ mcdi->mode = efx->vdpa_nic->mcdi_mode;
+ efx->mcdi_buf_mode = EFX_BUF_MODE_EF100;
+ spin_unlock_bh(&mcdi->iface_lock);
+
+ return 0;
+}
+
static void ef100_vdpa_free(struct vdpa_device *vdev)
{
struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
+ int rc;
int i;

if (vdpa_nic) {
+ if (vdpa_nic->efx->mcdi_buf_mode == EFX_BUF_MODE_VDPA) {
+ /* This will only be called via call to put_device()
+ * on vdpa device creation failure
+ */
+ rc = ef100_vdpa_map_mcdi_buffer(vdpa_nic->efx);
+ if (rc) {
+ dev_err(&vdev->dev,
+ "map_mcdi_buffer failed, err: %d\n",
+ rc);
+ }
+ }
+
for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
reset_vring(vdpa_nic, i);
if (vdpa_nic->vring[i].vring_ctx)
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
index 2c526d2edeb6..bc4de3b4e6f3 100644
--- a/drivers/net/ethernet/sfc/mcdi.h
+++ b/drivers/net/ethernet/sfc/mcdi.h
@@ -6,6 +6,9 @@

#ifndef EFX_MCDI_H
#define EFX_MCDI_H
+#include "mcdi_pcol.h"
+
+#define MCDI_BUF_LEN (8 + MCDI_CTL_SDU_LEN_MAX)

/**
* enum efx_mcdi_state - MCDI request handling state
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 948c7a06403a..9cdfeb6ad05a 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -848,6 +848,16 @@ enum efx_xdp_tx_queues_mode {

struct efx_mae;

+/**
+ * enum efx_buf_alloc_mode - buffer allocation mode
+ * @EFX_BUF_MODE_EF100: buffer setup in ef100 mode
+ * @EFX_BUF_MODE_VDPA: buffer setup in vdpa mode
+ */
+enum efx_buf_alloc_mode {
+ EFX_BUF_MODE_EF100,
+ EFX_BUF_MODE_VDPA
+};
+
/**
* struct efx_nic - an Efx NIC
* @name: Device name (net device name or bus id before net device registered)
@@ -877,6 +887,7 @@ struct efx_mae;
* @irq_rx_mod_step_us: Step size for IRQ moderation for RX event queues
* @irq_rx_moderation_us: IRQ moderation time for RX event queues
* @msg_enable: Log message enable flags
+ * @mcdi_buf_mode: mcdi buffer allocation mode
* @state: Device state number (%STATE_*). Serialised by the rtnl_lock.
* @reset_pending: Bitmask for pending resets
* @tx_queue: TX DMA queues
@@ -1045,6 +1056,7 @@ struct efx_nic {
u32 msg_enable;

enum nic_state state;
+ enum efx_buf_alloc_mode mcdi_buf_mode;
unsigned long reset_pending;

struct efx_channel *channel[EFX_MAX_CHANNELS];
--
2.30.1


2023-03-07 11:42:17

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 11/14] sfc: use PF's IOMMU domain for running VF's MCDI commands

This changeset uses MC_CMD_CLIENT_CMD to execute VF's MCDI
commands when running in vDPA mode (STATE_VDPA).
Also, use the PF's IOMMU domain for executing the encapsulated
VF's MCDI commands to isolate DMA of guest buffers in the VF's
IOMMU domain.
This patch also updates the PCIe FN's client id in the efx_nic
structure which is required while running MC_CMD_CLIENT_CMD.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/ef100.c | 1 +
drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++
drivers/net/ethernet/sfc/mcdi.c | 108 ++++++++++++++++++++++----
drivers/net/ethernet/sfc/mcdi.h | 2 +-
drivers/net/ethernet/sfc/net_driver.h | 2 +
drivers/net/ethernet/sfc/ptp.c | 4 +-
6 files changed, 132 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
index c1c69783db7b..8453c9ba0f41 100644
--- a/drivers/net/ethernet/sfc/ef100.c
+++ b/drivers/net/ethernet/sfc/ef100.c
@@ -465,6 +465,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
efx->type = (const struct efx_nic_type *)entry->driver_data;

efx->pci_dev = pci_dev;
+ efx->client_id = MC_CMD_CLIENT_ID_SELF;
pci_set_drvdata(pci_dev, efx);
rc = efx_init_struct(efx, pci_dev);
if (rc)
diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
index bda4fcbe1126..cd9f724a9e64 100644
--- a/drivers/net/ethernet/sfc/ef100_nic.c
+++ b/drivers/net/ethernet/sfc/ef100_nic.c
@@ -206,9 +206,11 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
"firmware reports num_mac_stats = %u\n",
efx->num_mac_stats);

+#ifdef CONFIG_SFC_VDPA
nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
CLIENT_CMD_VF_PROXY) &&
efx->type->is_vf;
+#endif
return 0;
}

@@ -1086,6 +1088,35 @@ static int ef100_check_design_params(struct efx_nic *efx)
return rc;
}

+static int efx_ef100_update_client_id(struct efx_nic *efx)
+{
+ struct ef100_nic_data *nic_data = efx->nic_data;
+ unsigned int pf_index = PCIE_FUNCTION_PF_NULL;
+ unsigned int vf_index = PCIE_FUNCTION_VF_NULL;
+ efx_qword_t pciefn;
+ int rc;
+
+ if (efx->pci_dev->is_virtfn)
+ vf_index = nic_data->vf_index;
+ else
+ pf_index = nic_data->pf_index;
+
+ /* Construct PCIE_FUNCTION structure */
+ EFX_POPULATE_QWORD_3(pciefn,
+ PCIE_FUNCTION_PF, pf_index,
+ PCIE_FUNCTION_VF, vf_index,
+ PCIE_FUNCTION_INTF, PCIE_INTERFACE_CALLER);
+ /* look up self client ID */
+ rc = efx_ef100_lookup_client_id(efx, pciefn, &efx->client_id);
+ if (rc) {
+ pci_warn(efx->pci_dev,
+ "%s: Failed to get client ID, rc %d\n",
+ __func__, rc);
+ }
+
+ return rc;
+}
+
/* NIC probe and remove
*/
static int ef100_probe_main(struct efx_nic *efx)
@@ -1173,6 +1204,10 @@ static int ef100_probe_main(struct efx_nic *efx)
goto fail;
efx->port_num = rc;

+ rc = efx_ef100_update_client_id(efx);
+ if (rc)
+ goto fail;
+
efx_mcdi_print_fwver(efx, fw_version, sizeof(fw_version));
pci_dbg(efx->pci_dev, "Firmware version %s\n", fw_version);

diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index a7f2c31071e8..3bf1ebe05775 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -145,14 +145,15 @@ void efx_mcdi_fini(struct efx_nic *efx)
kfree(efx->mcdi);
}

-static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
- const efx_dword_t *inbuf, size_t inlen)
+static void efx_mcdi_send_request(struct efx_nic *efx, u32 client_id,
+ unsigned int cmd, const efx_dword_t *inbuf,
+ size_t inlen)
{
struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
#ifdef CONFIG_SFC_MCDI_LOGGING
char *buf = mcdi->logging_buffer; /* page-sized */
#endif
- efx_dword_t hdr[2];
+ efx_dword_t hdr[5];
size_t hdr_len;
u32 xflags, seqno;

@@ -179,7 +180,7 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
MCDI_HEADER_XFLAGS, xflags,
MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
hdr_len = 4;
- } else {
+ } else if (client_id == efx->client_id) {
/* MCDI v2 */
BUG_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
EFX_POPULATE_DWORD_7(hdr[0],
@@ -194,6 +195,35 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
hdr_len = 8;
+ } else {
+ /* MCDI v2 */
+ WARN_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
+ /* MCDI v2 with credentials of a different client */
+ BUILD_BUG_ON(MC_CMD_CLIENT_CMD_IN_LEN != 4);
+ /* Outer CLIENT_CMD wrapper command with client ID */
+ EFX_POPULATE_DWORD_7(hdr[0],
+ MCDI_HEADER_RESPONSE, 0,
+ MCDI_HEADER_RESYNC, 1,
+ MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
+ MCDI_HEADER_DATALEN, 0,
+ MCDI_HEADER_SEQ, seqno,
+ MCDI_HEADER_XFLAGS, xflags,
+ MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
+ EFX_POPULATE_DWORD_2(hdr[1],
+ MC_CMD_V2_EXTN_IN_EXTENDED_CMD,
+ MC_CMD_CLIENT_CMD,
+ MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen + 12);
+ MCDI_SET_DWORD(&hdr[2],
+ CLIENT_CMD_IN_CLIENT_ID, client_id);
+
+ /* MCDIv2 header for inner command */
+ EFX_POPULATE_DWORD_2(hdr[3],
+ MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
+ MCDI_HEADER_DATALEN, 0);
+ EFX_POPULATE_DWORD_2(hdr[4],
+ MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
+ MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
+ hdr_len = 20;
}

#ifdef CONFIG_SFC_MCDI_LOGGING
@@ -474,7 +504,8 @@ static void efx_mcdi_release(struct efx_mcdi_iface *mcdi)
&mcdi->async_list, struct efx_mcdi_async_param, list);
if (async) {
mcdi->state = MCDI_STATE_RUNNING_ASYNC;
- efx_mcdi_send_request(efx, async->cmd,
+ efx_mcdi_send_request(efx, efx->client_id,
+ async->cmd,
(const efx_dword_t *)(async + 1),
async->inlen);
mod_timer(&mcdi->async_timer,
@@ -797,7 +828,7 @@ static int efx_mcdi_proxy_wait(struct efx_nic *efx, u32 handle, bool quiet)
return mcdi->proxy_rx_status;
}

-static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
+static int _efx_mcdi_rpc(struct efx_nic *efx, u32 client_id, unsigned int cmd,
const efx_dword_t *inbuf, size_t inlen,
efx_dword_t *outbuf, size_t outlen,
size_t *outlen_actual, bool quiet, int *raw_rc)
@@ -811,7 +842,7 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
return -EINVAL;
}

- rc = efx_mcdi_rpc_start(efx, cmd, inbuf, inlen);
+ rc = efx_mcdi_rpc_start(efx, client_id, cmd, inbuf, inlen);
if (rc)
return rc;

@@ -836,7 +867,8 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,

/* We now retry the original request. */
mcdi->state = MCDI_STATE_RUNNING_SYNC;
- efx_mcdi_send_request(efx, cmd, inbuf, inlen);
+ efx_mcdi_send_request(efx, efx->client_id, cmd,
+ inbuf, inlen);

rc = _efx_mcdi_rpc_finish(efx, cmd, inlen,
outbuf, outlen, outlen_actual,
@@ -855,16 +887,44 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
return rc;
}

+#ifdef CONFIG_SFC_VDPA
+static bool is_mode_vdpa(struct efx_nic *efx)
+{
+ if (efx->pci_dev->is_virtfn &&
+ efx->pci_dev->physfn &&
+ efx->state == STATE_VDPA &&
+ efx->vdpa_nic)
+ return true;
+
+ return false;
+}
+#endif
+
static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
const efx_dword_t *inbuf, size_t inlen,
efx_dword_t *outbuf, size_t outlen,
size_t *outlen_actual, bool quiet)
{
+#ifdef CONFIG_SFC_VDPA
+ struct efx_nic *efx_pf;
+#endif
int raw_rc = 0;
int rc;

- rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
- outbuf, outlen, outlen_actual, true, &raw_rc);
+#ifdef CONFIG_SFC_VDPA
+ if (is_mode_vdpa(efx)) {
+ efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
+ rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd, inbuf,
+ inlen, outbuf, outlen, outlen_actual,
+ true, &raw_rc);
+ } else {
+#endif
+ rc = _efx_mcdi_rpc(efx, efx->client_id, cmd, inbuf,
+ inlen, outbuf, outlen, outlen_actual, true,
+ &raw_rc);
+#ifdef CONFIG_SFC_VDPA
+ }
+#endif

if ((rc == -EPROTO) && (raw_rc == MC_CMD_ERR_NO_EVB_PORT) &&
efx->type->is_vf) {
@@ -881,9 +941,22 @@ static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,

do {
usleep_range(delay_us, delay_us + 10000);
- rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
- outbuf, outlen, outlen_actual,
- true, &raw_rc);
+#ifdef CONFIG_SFC_VDPA
+ if (is_mode_vdpa(efx)) {
+ efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
+ rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd,
+ inbuf, inlen, outbuf, outlen,
+ outlen_actual, true,
+ &raw_rc);
+ } else {
+#endif
+ rc = _efx_mcdi_rpc(efx, efx->client_id,
+ cmd, inbuf, inlen, outbuf,
+ outlen, outlen_actual, true,
+ &raw_rc);
+#ifdef CONFIG_SFC_VDPA
+ }
+#endif
if (delay_us < 100000)
delay_us <<= 1;
} while ((rc == -EPROTO) &&
@@ -939,7 +1012,7 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
* function and is then responsible for calling efx_mcdi_display_error
* as needed.
*/
-int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
+int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned int cmd,
const efx_dword_t *inbuf, size_t inlen,
efx_dword_t *outbuf, size_t outlen,
size_t *outlen_actual)
@@ -948,7 +1021,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
outlen_actual, true);
}

-int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
+int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
const efx_dword_t *inbuf, size_t inlen)
{
struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
@@ -965,7 +1038,7 @@ int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
return -ENETDOWN;

efx_mcdi_acquire_sync(mcdi);
- efx_mcdi_send_request(efx, cmd, inbuf, inlen);
+ efx_mcdi_send_request(efx, client_id, cmd, inbuf, inlen);
return 0;
}

@@ -1009,7 +1082,8 @@ static int _efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd,
*/
if (mcdi->async_list.next == &async->list &&
efx_mcdi_acquire_async(mcdi)) {
- efx_mcdi_send_request(efx, cmd, inbuf, inlen);
+ efx_mcdi_send_request(efx, efx->client_id,
+ cmd, inbuf, inlen);
mod_timer(&mcdi->async_timer,
jiffies + MCDI_RPC_TIMEOUT);
}
diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
index dafab52aaef7..2c526d2edeb6 100644
--- a/drivers/net/ethernet/sfc/mcdi.h
+++ b/drivers/net/ethernet/sfc/mcdi.h
@@ -150,7 +150,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
efx_dword_t *outbuf, size_t outlen,
size_t *outlen_actual);

-int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
+int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
const efx_dword_t *inbuf, size_t inlen);
int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
efx_dword_t *outbuf, size_t outlen,
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 1da71deac71c..948c7a06403a 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -859,6 +859,7 @@ struct efx_mae;
* @secondary_list: List of &struct efx_nic instances for the secondary PCI
* functions of the controller, if this is for the primary function.
* Serialised by rtnl_lock.
+ * @client_id: client ID of this PCIe function
* @type: Controller type attributes
* @legacy_irq: IRQ number
* @workqueue: Workqueue for port reconfigures and the HW monitor.
@@ -1022,6 +1023,7 @@ struct efx_nic {
struct list_head secondary_list;
struct pci_dev *pci_dev;
unsigned int port_num;
+ u32 client_id;
const struct efx_nic_type *type;
int legacy_irq;
bool eeh_disabled_legacy_irq;
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index 9f07e1ba7780..d90d4f6b3824 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -1052,8 +1052,8 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)

/* Clear flag that signals MC ready */
WRITE_ONCE(*start, 0);
- rc = efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf,
- MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
+ rc = efx_mcdi_rpc_start(efx, MC_CMD_CLIENT_ID_SELF, MC_CMD_PTP,
+ synch_buf, MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
EFX_WARN_ON_ONCE_PARANOID(rc);

/* Wait for start from MCDI (or timeout) */
--
2.30.1


2023-03-07 11:43:21

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 14/14] sfc: register the vDPA device

Register the vDPA device which results in adding the device
to the vDPA bus which will be probed by either of the vDPA
bus drivers: virtio_vdpa or vhost_vdpa.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/ef100_vdpa.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
index 32182a01f6a5..a07dd5e8bfb0 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
@@ -237,8 +237,7 @@ static void ef100_vdpa_delete(struct efx_nic *efx)
}
}

- /* replace with _vdpa_unregister_device later */
- put_device(&vdpa_dev->dev);
+ _vdpa_unregister_device(&efx->vdpa_nic->vdpa_dev);
}
efx_mcdi_free_vis(efx);
}
@@ -388,7 +387,14 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
vdpa_nic->mac_configured = true;
}

- /* _vdpa_register_device when its ready */
+ rc = _vdpa_register_device(&vdpa_nic->vdpa_dev,
+ (allocated_vis - 1) * 2);
+ if (rc) {
+ pci_err(efx->pci_dev,
+ "vDPA device registration failed, vf: %u, rc: %d\n",
+ nic_data->vf_index, rc);
+ goto err_put_device;
+ }

return vdpa_nic;

--
2.30.1


2023-03-07 11:44:33

by Gautam Dawar

[permalink] [raw]
Subject: [PATCH net-next v2 13/14] sfc: update vdpa device MAC address

As the VF MAC address can now be updated using `devlink port function set`
interface, fetch the vdpa device MAC address from the underlying VF during
vdpa device creation.

Signed-off-by: Gautam Dawar <[email protected]>
---
drivers/net/ethernet/sfc/ef100_vdpa.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
index 30ca4ab00175..32182a01f6a5 100644
--- a/drivers/net/ethernet/sfc/ef100_vdpa.c
+++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
@@ -272,6 +272,18 @@ static int get_net_config(struct ef100_vdpa_nic *vdpa_nic)
vdpa_nic->net_config.max_virtqueue_pairs =
cpu_to_efx_vdpa16(vdpa_nic, vdpa_nic->max_queue_pairs);

+ rc = ef100_get_mac_address(efx, vdpa_nic->mac_address,
+ efx->client_id, true);
+ if (rc) {
+ dev_err(&vdpa_nic->vdpa_dev.dev,
+ "%s: Get MAC for vf:%u failed:%d\n", __func__,
+ vdpa_nic->vf_index, rc);
+ return rc;
+ }
+
+ if (is_valid_ether_addr(vdpa_nic->mac_address))
+ vdpa_nic->mac_configured = true;
+
rc = efx_vdpa_get_mtu(efx, &mtu);
if (rc) {
dev_err(&vdpa_nic->vdpa_dev.dev,
--
2.30.1


2023-03-08 16:16:20

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 03/14] sfc: update MCDI headers for CLIENT_CMD_VF_PROXY capability bit

On Tue, Mar 07, 2023 at 12:12:15PM +0000, Lucero Palau, Alejandro wrote:
>
> On 3/7/23 11:36, Gautam Dawar wrote:
> > vDPA requires the ability to proxy MCDI commands from a PF to a VF
> > there by using PF's IOMMU domain for executing vDPA VF's MCDI commands
> > ensuring isolation from the DMA domain used by guest buffers.
> > A new capability bit CLIENT_CMD_VF_PROXY has been added to Firmware,
> > which when exposed, suggests that Firmware supports MC_CMD_CLIENT_CMD
> > to VFs and hence supports vDPA requirement.
> > mcdi_pcol.h is a tool generated file and hence may not be free from
> > all checks and/or warnings when tested with checkpatch.pl script.
> >
> > Signed-off-by: Gautam Dawar <[email protected]>
> > ---
> > drivers/net/ethernet/sfc/mcdi_pcol.h | 4390 +++++++++++++++++++++++++-
> > drivers/net/ethernet/sfc/mcdi_vdpa.c | 10 +-
> > 2 files changed, 4288 insertions(+), 112 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/sfc/mcdi_pcol.h b/drivers/net/ethernet/sfc/mcdi_pcol.h
> > index cd297e19cddc..bdb6a53b8be3 100644
> > --- a/drivers/net/ethernet/sfc/mcdi_pcol.h
> > +++ b/drivers/net/ethernet/sfc/mcdi_pcol.h
> > @@ -2,10 +2,9 @@
> > /****************************************************************************
> > * Driver for Solarflare network controllers and boards
> > * Copyright 2009-2018 Solarflare Communications Inc.
> > - * Copyright 2019-2020 Xilinx Inc.
> > + * Copyright 2019-2022 Xilinx Inc.
> > */
> >
> 2023?
>
> > -
> > #ifndef MCDI_PCOL_H
> > #define MCDI_PCOL_H
> >
> > @@ -72,19 +71,19 @@
> > * | \------- Error
> > * \------------------------------ Resync (always set)
> > *
> > - * The client writes it's request into MC shared memory, and rings the
> > - * doorbell. Each request is completed by either by the MC writing
> > + * The client writes its request into MC shared memory, and rings the
> > + * doorbell. Each request is completed either by the MC writing
>
> It seems this patch has been also seized for fixing a good number of typos.
> I would not mind if one or two go into, but that is not the case here.
> All those fixes should be in another patch out of this patchset.

As stated in the description, mcdi_pcol.h is a generated file. We cannot
pick and choose what parts to pick up, we always have to use the latest
version that contains the changes we need.

Martin

> > * back into shared memory, or by writing out an event.
> > *
> > * All MCDI commands support completion by shared memory response. Each
> > * request may also contain additional data (accounted for by HEADER.LEN),
> > - * and some response's may also contain additional data (again, accounted
> > + * and some responses may also contain additional data (again, accounted
> > * for by HEADER.LEN).
> > *
> > * Some MCDI commands support completion by event, in which any associated
> > * response data is included in the event.
> > *
> > - * The protocol requires one response to be delivered for every request, a
> > + * The protocol requires one response to be delivered for every request; a
> > * request should not be sent unless the response for the previous request
> > * has been received (either by polling shared memory, or by receiving
> > * an event).
> > @@ -121,7 +120,6 @@
> >
> > #define MCDI_CTL_SDU_LEN_MAX MCDI_CTL_SDU_LEN_MAX_V2
> >
> > -
> > /* The MC can generate events for two reasons:
> > * - To advance a shared memory request if XFLAGS_EVREQ was set
> > * - As a notification (link state, i2c event), controlled
> > @@ -165,6 +163,7 @@
> > #define FSE_AZ_EV_CODE_MCDI_EVRESPONSE 0xc
> >
> >
> > +
> > #define MC_CMD_ERR_CODE_OFST 0
> > #define MC_CMD_ERR_PROXY_PENDING_HANDLE_OFST 4
> >
> > @@ -228,7 +227,6 @@
> > */
> > #define EVB_STACK_ID(n) (((n) & 0xff) << 16)
> >
> > -
> > /* Version 2 adds an optional argument to error returns: the errno value
> > * may be followed by the (0-based) number of the first argument that
> > * could not be processed.
> > @@ -321,7 +319,7 @@
> > /* enum: The requesting client is not a function */
> > #define MC_CMD_ERR_CLIENT_NOT_FN 0x100c
> > /* enum: The requested operation might require the command to be passed between
> > - * MCs, and thetransport doesn't support that. Should only ever been seen over
> > + * MCs, and the transport doesn't support that. Should only ever been seen over
> > * the UART.
> > */
> > #define MC_CMD_ERR_TRANSPORT_NOPROXY 0x100d
> > @@ -358,7 +356,7 @@
> > * sub-variant switching.
> > */
> > #define MC_CMD_ERR_FILTERS_PRESENT 0x1014
> > -/* enum: The clock whose frequency you've attempted to set set doesn't exist on
> > +/* enum: The clock whose frequency you've attempted to set doesn't exist on
> > * this NIC
> > */
> > #define MC_CMD_ERR_NO_CLOCK 0x1015
> > @@ -640,7 +638,11 @@
> > * be allocated by different counter blocks, so e.g. AR counter 42 is different
> > * from CT counter 42. Generation counts are also type-specific. This value is
> > * also present in the header of streaming counter packets, in the IDENTIFIER
> > - * field (see packetiser packet format definitions).
> > + * field (see packetiser packet format definitions). Also note that LACP
> > + * counter IDs are not allocated individually, instead the counter IDs are
> > + * directly tied to the LACP balance table indices. These in turn are allocated
> > + * in large contiguous blocks as a LAG config. Calling MAE_COUNTER_ALLOC/FREE
> > + * with an LACP counter type will return EPERM.
> > */
> > /* enum: Action Rule counters - can be referenced in AR response. */
> > #define MAE_COUNTER_TYPE_AR 0x0
> > @@ -648,6 +650,14 @@
> > #define MAE_COUNTER_TYPE_CT 0x1
> > /* enum: Outer Rule counters - can be referenced in OR response. */
> > #define MAE_COUNTER_TYPE_OR 0x2
> > +/* enum: LACP counters - linked to LACP balance table entries. */
> > +#define MAE_COUNTER_TYPE_LACP 0x3
> > +
> > +/* MAE_COUNTER_ID enum: ID of allocated counter or counter list. */
> > +/* enum: A counter ID that is guaranteed never to represent a real counter or
> > + * counter list.
> > + */
> > +#define MAE_COUNTER_ID_NULL 0xffffffff
> >
> > /* TABLE_ID enum: Unique IDs for tables. The 32-bit ID values have been
> > * structured with bits [31:24] reserved (0), [23:16] indicating which major
> > @@ -656,7 +666,9 @@
> > * variations of the same table. (All of the tables currently defined within
> > * the streaming engines are listed here, but this does not imply that they are
> > * all supported - MC_CMD_TABLE_LIST returns the list of actually supported
> > - * tables.)
> > + * tables.) The DPU offload engines' enumerators follow a deliberate pattern:
> > + * 0x01010000 + is_dpu_net * 0x10000 + is_wr_or_tx * 0x8000 + is_lite_pipe *
> > + * 0x1000 + oe_engine_type * 0x100 + oe_instance_within_pipe * 0x10
> > */
> > /* enum: Outer_Rule_Table in the MAE - refer to SF-123102-TC. */
> > #define TABLE_ID_OUTER_RULE_TABLE 0x10000
> > @@ -694,6 +706,70 @@
> > #define TABLE_ID_RSS_CONTEXT_TABLE 0x20200
> > /* enum: Indirection_Table in VNIC Rx - refer to SF-123102-TC. */
> > #define TABLE_ID_INDIRECTION_TABLE 0x20300
> > +/* enum: DPU.host read pipe first CRC offload engine profiles - refer to
> > + * XN-200147-AN.
>
> I think this is an internal document not available to the public.
> Please, remove all those references.
>
> > + */
> > +#define TABLE_ID_DPU_HOST_RD_CRC0_OE_PROFILE 0x1010000
> > +/* enum: DPU.host read pipe second CRC offload engine profiles - refer to
> > + * XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_HOST_RD_CRC1_OE_PROFILE 0x1010010
> > +/* enum: DPU.host write pipe first CRC offload engine profiles - refer to
> > + * XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_HOST_WR_CRC0_OE_PROFILE 0x1018000
> > +/* enum: DPU.host write pipe second CRC offload engine profiles - refer to
> > + * XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_HOST_WR_CRC1_OE_PROFILE 0x1018010
> > +/* enum: DPU.net 'full' receive pipe CRC offload engine profiles - refer to
> > + * XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_RX_CRC0_OE_PROFILE 0x1020000
> > +/* enum: DPU.net 'full' receive pipe first checksum offload engine profiles -
> > + * refer to XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_RX_CSUM0_OE_PROFILE 0x1020100
> > +/* enum: DPU.net 'full' receive pipe second checksum offload engine profiles -
> > + * refer to XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_RX_CSUM1_OE_PROFILE 0x1020110
> > +/* enum: DPU.net 'full' receive pipe AES-GCM offload engine profiles - refer to
> > + * XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_RX_AES_GCM0_OE_PROFILE 0x1020200
> > +/* enum: DPU.net 'lite' receive pipe CRC offload engine profiles - refer to
> > + * XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_RXLITE_CRC0_OE_PROFILE 0x1021000
> > +/* enum: DPU.net 'lite' receive pipe checksum offload engine profiles - refer
> > + * to XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_RXLITE_CSUM0_OE_PROFILE 0x1021100
> > +/* enum: DPU.net 'full' transmit pipe CRC offload engine profiles - refer to
> > + * XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_TX_CRC0_OE_PROFILE 0x1028000
> > +/* enum: DPU.net 'full' transmit pipe first checksum offload engine profiles -
> > + * refer to XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_TX_CSUM0_OE_PROFILE 0x1028100
> > +/* enum: DPU.net 'full' transmit pipe second checksum offload engine profiles -
> > + * refer to XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_TX_CSUM1_OE_PROFILE 0x1028110
> > +/* enum: DPU.net 'full' transmit pipe AES-GCM offload engine profiles - refer
> > + * to XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_TX_AES_GCM0_OE_PROFILE 0x1028200
> > +/* enum: DPU.net 'lite' transmit pipe CRC offload engine profiles - refer to
> > + * XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_TXLITE_CRC0_OE_PROFILE 0x1029000
> > +/* enum: DPU.net 'lite' transmit pipe checksum offload engine profiles - refer
> > + * to XN-200147-AN.
> > + */
> > +#define TABLE_ID_DPU_NET_TXLITE_CSUM0_OE_PROFILE 0x1029100
> >
> > /* TABLE_COMPRESSED_VLAN enum: Compressed VLAN TPID as used by some field
> > * types; can be calculated by (((ether_type_msb >> 2) & 0x4) ^ 0x4) |
> > @@ -734,6 +810,42 @@
> > /* enum: RSS uses even spreading calculation. */
> > #define TABLE_RSS_SPREAD_MODE_EVEN 0x1
> >
> > +/* CRC_VARIANT enum: Operation for the DPU CRC engine to perform. */
> > +/* enum: Calculate a 32-bit CRC. */
> > +#define CRC_VARIANT_CRC32 0x1
> > +/* enum: Calculate a 64-bit CRC. */
> > +#define CRC_VARIANT_CRC64 0x2
> > +
> > +/* DPU_CSUM_OP enum: Operation for the DPU checksum engine to perform. */
> > +/* enum: Calculate the checksum for a TCP payload, output result on OPR bus. */
> > +#define DPU_CSUM_OP_CALC_TCP 0x0
> > +/* enum: Calculate the checksum for a UDP payload, output result on OPR bus. */
> > +#define DPU_CSUM_OP_CALC_UDP 0x1
> > +/* enum: Calculate the checksum for a TCP payload, output match/not match value
> > + * on OPR bus.
> > + */
> > +#define DPU_CSUM_OP_VALIDATE_TCP 0x2
> > +/* enum: Calculate the checksum for a UDP payload, output match/not match value
> > + * on OPR bus.
> > + */
> > +#define DPU_CSUM_OP_VALIDATE_UDP 0x3
> > +
> > +/* GCM_OP_CODE enum: Operation for the DPU AES-GCM engine to perform. */
> > +/* enum: Encrypt/decrypt a stream of data. */
> > +#define GCM_OP_CODE_BULK_CRYPT 0x0
> > +/* enum: Calculate the authentication tag for a stream of data. */
> > +#define GCM_OP_CODE_BULK_AUTH 0x1
> > +/* enum: Encrypt/decrypt an IPsec packet. */
> > +#define GCM_OP_CODE_IPSEC_CRYPT 0x2
> > +/* enum: Calculate the authentication tag of an IPsec packet. */
> > +#define GCM_OP_CODE_IPSEC_AUTH 0x3
> > +
> > +/* AES_KEY_LEN enum: Key size for AES crypto operations */
> > +/* enum: 128 bit key size. */
> > +#define AES_KEY_LEN_AES_KEY_128 0x0
> > +/* enum: 256 bit key size. */
> > +#define AES_KEY_LEN_AES_KEY_256 0x1
> > +
> > /* TABLE_FIELD_ID enum: Unique IDs for fields. Related concepts have been
> > * loosely grouped together into blocks with gaps for expansion, but the values
> > * are arbitrary. Field IDs are not specific to particular tables, and in some
> > @@ -1026,6 +1138,16 @@
> > #define TABLE_FIELD_ID_BAL_TBL_BASE_DIV64 0xde
> > /* enum: Length of balance table region: 0=>64, 1=>128, 2=>256. */
> > #define TABLE_FIELD_ID_BAL_TBL_LEN_ID 0xdf
> > +/* enum: LACP LAG ID (i.e. the low 3 bits of LACP LAG mport ID), indexing
> > + * LACP_LAG_Config_Table. Refer to SF-123102-TC.
> > + */
> > +#define TABLE_FIELD_ID_LACP_LAG_ID 0xe0
> > +/* enum: Address in LACP_Balance_Table. The balance table is partitioned
> > + * between LAGs according to the settings in LACP_LAG_Config_Table and then
> > + * indexed by the LACP hash, providing the mapping to destination mports. Refer
> > + * to SF-123102-TC.
> > + */
> > +#define TABLE_FIELD_ID_BAL_TBL_ADDR 0xe1
> > /* enum: UDP port to match for UDP-based encapsulations; required to be 0 for
> > * other encapsulation types.
> > */
> > @@ -1082,6 +1204,58 @@
> > #define TABLE_FIELD_ID_INDIR_TBL_LEN_ID 0x105
> > /* enum: An offset to be applied to the base destination queue ID. */
> > #define TABLE_FIELD_ID_INDIR_OFFSET 0x106
> > +/* enum: DPU offload engine profile ID to address. */
> > +#define TABLE_FIELD_ID_OE_PROFILE 0x3e8
> > +/* enum: Width of the CRC to calculate - see CRC_VARIANT enum. */
> > +#define TABLE_FIELD_ID_CRC_VARIANT 0x3f2
> > +/* enum: If set, reflect the bits of each input byte, bit 7 is LSB, bit 0 is
> > + * MSB. If clear, bit 7 is MSB, bit 0 is LSB.
> > + */
> > +#define TABLE_FIELD_ID_CRC_REFIN 0x3f3
> > +/* enum: If set, reflect the bits of each output byte, bit 7 is LSB, bit 0 is
> > + * MSB. If clear, bit 7 is MSB, bit 0 is LSB.
> > + */
> > +#define TABLE_FIELD_ID_CRC_REFOUT 0x3f4
> > +/* enum: If set, invert every bit of the output value. */
> > +#define TABLE_FIELD_ID_CRC_INVOUT 0x3f5
> > +/* enum: The CRC polynomial to use for checksumming, in normal form. See
> > + * https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Specification for a
> > + * description of normal form.
> > + */
> > +#define TABLE_FIELD_ID_CRC_POLY 0x3f6
> > +/* enum: Operation for the checksum engine to perform - see DPU_CSUM_OP enum.
> > + */
> > +#define TABLE_FIELD_ID_CSUM_OP 0x410
> > +/* enum: Byte offset of checksum relative to region_start (for VALIDATE_*
> > + * operations only).
> > + */
> > +#define TABLE_FIELD_ID_CSUM_OFFSET 0x411
> > +/* enum: Indicates there is additional data on OPR bus that needs to be
> > + * incorporated into the payload checksum.
> > + */
> > +#define TABLE_FIELD_ID_CSUM_OPR_ADDITIONAL_DATA 0x412
> > +/* enum: Log2 data size of additional data on OPR bus. */
> > +#define TABLE_FIELD_ID_CSUM_OPR_DATA_SIZE_LOG2 0x413
> > +/* enum: 4 byte offset of where to find the additional data on the OPR bus. */
> > +#define TABLE_FIELD_ID_CSUM_OPR_4B_OFF 0x414
> > +/* enum: Operation type for the AES-GCM core - see GCM_OP_CODE enum. */
> > +#define TABLE_FIELD_ID_GCM_OP_CODE 0x41a
> > +/* enum: Key length - AES_KEY_LEN enum. */
> > +#define TABLE_FIELD_ID_GCM_KEY_LEN 0x41b
> > +/* enum: OPR 4 byte offset for ICV or GHASH output (only in BULK_* mode) or
> > + * IPSEC descrypt output.
> > + */
> > +#define TABLE_FIELD_ID_GCM_OPR_4B_OFFSET 0x41c
> > +/* enum: If OP_CODE is BULK_*, indicates Emit GHASH (Fragment mode). Else,
> > + * indicates IPSEC-ESN mode.
> > + */
> > +#define TABLE_FIELD_ID_GCM_EMIT_GHASH_ISESN 0x41d
> > +/* enum: Replay Protection Enable. */
> > +#define TABLE_FIELD_ID_GCM_REPLAY_PROTECT_EN 0x41e
> > +/* enum: IPSEC Encrypt ESP trailer NEXT_HEADER byte. */
> > +#define TABLE_FIELD_ID_GCM_NEXT_HDR 0x41f
> > +/* enum: Replay Window Size. */
> > +#define TABLE_FIELD_ID_GCM_REPLAY_WIN_SIZE 0x420
> >
> > /* MCDI_EVENT structuredef: The structure of an MCDI_EVENT on Siena/EF10/EF100
> > * platforms
> > @@ -1237,7 +1411,7 @@
> > #define MCDI_EVENT_AOE_FPGA_LOAD_FAILED 0xe
> > /* enum: Notify that invalid flash type detected */
> > #define MCDI_EVENT_AOE_INVALID_FPGA_FLASH_TYPE 0xf
> > -/* enum: Notify that the attempt to run FPGA Controller firmware timedout */
> > +/* enum: Notify that the attempt to run FPGA Controller firmware timed out */
> > #define MCDI_EVENT_AOE_FC_RUN_TIMEDOUT 0x10
> > /* enum: Failure to probe one or more FPGA boot flash chips */
> > #define MCDI_EVENT_AOE_FPGA_BOOT_FLASH_INVALID 0x11
> > @@ -1255,7 +1429,7 @@
> > #define MCDI_EVENT_AOE_ERR_FC_ASSERT_INFO_WIDTH 8
> > /* enum: FC Assert happened, but the register information is not available */
> > #define MCDI_EVENT_AOE_ERR_FC_ASSERT_SEEN 0x0
> > -/* enum: The register information for FC Assert is ready for readinng by driver
> > +/* enum: The register information for FC Assert is ready for reading by driver
> > */
> > #define MCDI_EVENT_AOE_ERR_FC_ASSERT_DATA_READY 0x1
> > #define MCDI_EVENT_AOE_ERR_CODE_FPGA_HEADER_VERIFY_FAILED_OFST 0
> > @@ -1364,6 +1538,12 @@
> > #define MCDI_EVENT_MODULECHANGE_SEQ_OFST 0
> > #define MCDI_EVENT_MODULECHANGE_SEQ_LBN 30
> > #define MCDI_EVENT_MODULECHANGE_SEQ_WIDTH 2
> > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_OFST 0
> > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_LBN 0
> > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_WIDTH 16
> > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_OFST 0
> > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_LBN 16
> > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_WIDTH 16
> > #define MCDI_EVENT_DATA_LBN 0
> > #define MCDI_EVENT_DATA_WIDTH 32
> > /* Alias for PTP_DATA. */
> > @@ -1500,6 +1680,12 @@
> > * change to the journal.
> > */
> > #define MCDI_EVENT_CODE_MPORT_JOURNAL_CHANGE 0x27
> > +/* enum: Notification that a source queue is enabled and attached to its proxy
> > + * sink queue. SRC field contains the handle of the affected descriptor proxy
> > + * function. DATA field contains the relative source queue number and absolute
> > + * VI ID.
> > + */
> > +#define MCDI_EVENT_CODE_DESC_PROXY_FUNC_QUEUE_START 0x28
> > /* enum: Artificial event generated by host and posted via MC for test
> > * purposes.
> > */
> > @@ -1977,7 +2163,7 @@
> > #define MC_CMD_COPYCODE 0x3
> > #undef MC_CMD_0x3_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x3_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x3_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_COPYCODE_IN msgrequest */
> > #define MC_CMD_COPYCODE_IN_LEN 16
> > @@ -3943,11 +4129,15 @@
> > /***********************************/
> > /* MC_CMD_CSR_READ32
> > * Read 32bit words from the indirect memory map.
> > + *
> > + * Note - this command originally belonged to INSECURE category. But access is
> > + * required to specific registers for customer diagnostics. The command handler
> > + * has additional checks to reject insecure calls.
> > */
> > #define MC_CMD_CSR_READ32 0xc
> > #undef MC_CMD_0xc_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0xc_PRIVILEGE_CTG SRIOV_CTG_INSECURE
> > +#define MC_CMD_0xc_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> >
> > /* MC_CMD_CSR_READ32_IN msgrequest */
> > #define MC_CMD_CSR_READ32_IN_LEN 12
> > @@ -4013,7 +4203,7 @@
> > #define MC_CMD_HP 0x54
> > #undef MC_CMD_0x54_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x54_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x54_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_HP_IN msgrequest */
> > #define MC_CMD_HP_IN_LEN 16
> > @@ -4931,6 +5121,53 @@
> > /* MC_CMD_GET_PHY_CFG_IN msgrequest */
> > #define MC_CMD_GET_PHY_CFG_IN_LEN 0
> >
> > +/* MC_CMD_GET_PHY_CFG_IN_V2 msgrequest */
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_LEN 8
> > +/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > + * identifies a real or virtual network port by MAE port and link end. See the
> > + * structure definition for more details
> > + */
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_OFST 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LEN 8
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_OFST 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_LEN 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_LBN 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_WIDTH 32
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_OFST 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_LEN 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_LBN 32
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_WIDTH 32
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LINK_END_OFST 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LINK_END_LEN 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_OFST 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LEN 8
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_OFST 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_LEN 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_LBN 0
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_WIDTH 32
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_OFST 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_LEN 4
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_LBN 32
> > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_WIDTH 32
> > +
> > /* MC_CMD_GET_PHY_CFG_OUT msgresponse */
> > #define MC_CMD_GET_PHY_CFG_OUT_LEN 72
> > /* flags */
> > @@ -5026,6 +5263,9 @@
> > #define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_OFST 8
> > #define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_LBN 21
> > #define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_WIDTH 1
> > +#define MC_CMD_PHY_CAP_200000FDX_OFST 8
> > +#define MC_CMD_PHY_CAP_200000FDX_LBN 22
> > +#define MC_CMD_PHY_CAP_200000FDX_WIDTH 1
> > /* ?? */
> > #define MC_CMD_GET_PHY_CFG_OUT_CHANNEL_OFST 12
> > #define MC_CMD_GET_PHY_CFG_OUT_CHANNEL_LEN 4
> > @@ -5084,7 +5324,7 @@
> > #define MC_CMD_START_BIST 0x25
> > #undef MC_CMD_0x25_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x25_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x25_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_START_BIST_IN msgrequest */
> > #define MC_CMD_START_BIST_IN_LEN 4
> > @@ -5124,7 +5364,7 @@
> > #define MC_CMD_POLL_BIST 0x26
> > #undef MC_CMD_0x26_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x26_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x26_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_POLL_BIST_IN msgrequest */
> > #define MC_CMD_POLL_BIST_IN_LEN 0
> > @@ -5320,6 +5560,53 @@
> > /* MC_CMD_GET_LOOPBACK_MODES_IN msgrequest */
> > #define MC_CMD_GET_LOOPBACK_MODES_IN_LEN 0
> >
> > +/* MC_CMD_GET_LOOPBACK_MODES_IN_V2 msgrequest */
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_LEN 8
> > +/* Target port to request loopback modes for. Uses MAE_LINK_ENDPOINT_SELECTOR
> > + * which identifies a real or virtual network port by MAE port and link end.
> > + * See the structure definition for more details
> > + */
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_OFST 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_OFST 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_LBN 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_OFST 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_LBN 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LINK_END_OFST 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LINK_END_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_OFST 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_OFST 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_LBN 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_OFST 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_LBN 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_WIDTH 32
> > +
> > /* MC_CMD_GET_LOOPBACK_MODES_OUT msgresponse */
> > #define MC_CMD_GET_LOOPBACK_MODES_OUT_LEN 40
> > /* Supported loopbacks. */
> > @@ -5649,6 +5936,204 @@
> > /* Enum values, see field(s): */
> > /* 100M */
> >
> > +/* MC_CMD_GET_LOOPBACK_MODES_OUT_V3 msgresponse: Supported loopback modes for
> > + * newer NICs with 200G support
> > + */
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_LEN 72
> > +/* Supported loopbacks. */
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_OFST 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_OFST 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_LBN 0
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_OFST 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_LBN 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_WIDTH 32
> > +/* enum: None. */
> > +/* MC_CMD_LOOPBACK_NONE 0x0 */
> > +/* enum: Data. */
> > +/* MC_CMD_LOOPBACK_DATA 0x1 */
> > +/* enum: GMAC. */
> > +/* MC_CMD_LOOPBACK_GMAC 0x2 */
> > +/* enum: XGMII. */
> > +/* MC_CMD_LOOPBACK_XGMII 0x3 */
> > +/* enum: XGXS. */
> > +/* MC_CMD_LOOPBACK_XGXS 0x4 */
> > +/* enum: XAUI. */
> > +/* MC_CMD_LOOPBACK_XAUI 0x5 */
> > +/* enum: GMII. */
> > +/* MC_CMD_LOOPBACK_GMII 0x6 */
> > +/* enum: SGMII. */
> > +/* MC_CMD_LOOPBACK_SGMII 0x7 */
> > +/* enum: XGBR. */
> > +/* MC_CMD_LOOPBACK_XGBR 0x8 */
> > +/* enum: XFI. */
> > +/* MC_CMD_LOOPBACK_XFI 0x9 */
> > +/* enum: XAUI Far. */
> > +/* MC_CMD_LOOPBACK_XAUI_FAR 0xa */
> > +/* enum: GMII Far. */
> > +/* MC_CMD_LOOPBACK_GMII_FAR 0xb */
> > +/* enum: SGMII Far. */
> > +/* MC_CMD_LOOPBACK_SGMII_FAR 0xc */
> > +/* enum: XFI Far. */
> > +/* MC_CMD_LOOPBACK_XFI_FAR 0xd */
> > +/* enum: GPhy. */
> > +/* MC_CMD_LOOPBACK_GPHY 0xe */
> > +/* enum: PhyXS. */
> > +/* MC_CMD_LOOPBACK_PHYXS 0xf */
> > +/* enum: PCS. */
> > +/* MC_CMD_LOOPBACK_PCS 0x10 */
> > +/* enum: PMA-PMD. */
> > +/* MC_CMD_LOOPBACK_PMAPMD 0x11 */
> > +/* enum: Cross-Port. */
> > +/* MC_CMD_LOOPBACK_XPORT 0x12 */
> > +/* enum: XGMII-Wireside. */
> > +/* MC_CMD_LOOPBACK_XGMII_WS 0x13 */
> > +/* enum: XAUI Wireside. */
> > +/* MC_CMD_LOOPBACK_XAUI_WS 0x14 */
> > +/* enum: XAUI Wireside Far. */
> > +/* MC_CMD_LOOPBACK_XAUI_WS_FAR 0x15 */
> > +/* enum: XAUI Wireside near. */
> > +/* MC_CMD_LOOPBACK_XAUI_WS_NEAR 0x16 */
> > +/* enum: GMII Wireside. */
> > +/* MC_CMD_LOOPBACK_GMII_WS 0x17 */
> > +/* enum: XFI Wireside. */
> > +/* MC_CMD_LOOPBACK_XFI_WS 0x18 */
> > +/* enum: XFI Wireside Far. */
> > +/* MC_CMD_LOOPBACK_XFI_WS_FAR 0x19 */
> > +/* enum: PhyXS Wireside. */
> > +/* MC_CMD_LOOPBACK_PHYXS_WS 0x1a */
> > +/* enum: PMA lanes MAC-Serdes. */
> > +/* MC_CMD_LOOPBACK_PMA_INT 0x1b */
> > +/* enum: KR Serdes Parallel (Encoder). */
> > +/* MC_CMD_LOOPBACK_SD_NEAR 0x1c */
> > +/* enum: KR Serdes Serial. */
> > +/* MC_CMD_LOOPBACK_SD_FAR 0x1d */
> > +/* enum: PMA lanes MAC-Serdes Wireside. */
> > +/* MC_CMD_LOOPBACK_PMA_INT_WS 0x1e */
> > +/* enum: KR Serdes Parallel Wireside (Full PCS). */
> > +/* MC_CMD_LOOPBACK_SD_FEP2_WS 0x1f */
> > +/* enum: KR Serdes Parallel Wireside (Sym Aligner to TX). */
> > +/* MC_CMD_LOOPBACK_SD_FEP1_5_WS 0x20 */
> > +/* enum: KR Serdes Parallel Wireside (Deserializer to Serializer). */
> > +/* MC_CMD_LOOPBACK_SD_FEP_WS 0x21 */
> > +/* enum: KR Serdes Serial Wireside. */
> > +/* MC_CMD_LOOPBACK_SD_FES_WS 0x22 */
> > +/* enum: Near side of AOE Siena side port */
> > +/* MC_CMD_LOOPBACK_AOE_INT_NEAR 0x23 */
> > +/* enum: Medford Wireside datapath loopback */
> > +/* MC_CMD_LOOPBACK_DATA_WS 0x24 */
> > +/* enum: Force link up without setting up any physical loopback (snapper use
> > + * only)
> > + */
> > +/* MC_CMD_LOOPBACK_FORCE_EXT_LINK 0x25 */
> > +/* Supported loopbacks. */
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_OFST 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_OFST 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_LBN 64
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_OFST 12
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_LBN 96
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_WIDTH 32
> > +/* Enum values, see field(s): */
> > +/* 100M */
> > +/* Supported loopbacks. */
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_OFST 16
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_OFST 16
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_LBN 128
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_OFST 20
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_LBN 160
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_WIDTH 32
> > +/* Enum values, see field(s): */
> > +/* 100M */
> > +/* Supported loopbacks. */
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_OFST 24
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_OFST 24
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_LBN 192
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_OFST 28
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_LBN 224
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_WIDTH 32
> > +/* Enum values, see field(s): */
> > +/* 100M */
> > +/* Supported loopbacks. */
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_OFST 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_OFST 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_LBN 256
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_OFST 36
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_LBN 288
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_WIDTH 32
> > +/* Enum values, see field(s): */
> > +/* 100M */
> > +/* Supported 25G loopbacks. */
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_OFST 40
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_OFST 40
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_LBN 320
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_OFST 44
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_LBN 352
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_WIDTH 32
> > +/* Enum values, see field(s): */
> > +/* 100M */
> > +/* Supported 50 loopbacks. */
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_OFST 48
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_OFST 48
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_LBN 384
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_OFST 52
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_LBN 416
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_WIDTH 32
> > +/* Enum values, see field(s): */
> > +/* 100M */
> > +/* Supported 100G loopbacks. */
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_OFST 56
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_OFST 56
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_LBN 448
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_OFST 60
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_LBN 480
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_WIDTH 32
> > +/* Enum values, see field(s): */
> > +/* 100M */
> > +/* Supported 200G loopbacks. */
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_OFST 64
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LEN 8
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_OFST 64
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_LBN 512
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_WIDTH 32
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_OFST 68
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_LEN 4
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_LBN 544
> > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_WIDTH 32
> > +/* Enum values, see field(s): */
> > +/* 100M */
> > +
> > /* AN_TYPE structuredef: Auto-negotiation types defined in IEEE802.3 */
> > #define AN_TYPE_LEN 4
> > #define AN_TYPE_TYPE_OFST 0
> > @@ -5694,6 +6179,53 @@
> > /* MC_CMD_GET_LINK_IN msgrequest */
> > #define MC_CMD_GET_LINK_IN_LEN 0
> >
> > +/* MC_CMD_GET_LINK_IN_V2 msgrequest */
> > +#define MC_CMD_GET_LINK_IN_V2_LEN 8
> > +/* Target port to request link state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > + * identifies a real or virtual network port by MAE port and link end. See the
> > + * structure definition for more details.
> > + */
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_OFST 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LEN 8
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_OFST 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_LEN 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_LBN 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_WIDTH 32
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_OFST 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_LEN 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_LBN 32
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_WIDTH 32
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LINK_END_OFST 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LINK_END_LEN 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_OFST 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LEN 8
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_OFST 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_LEN 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_LBN 0
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_WIDTH 32
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_OFST 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_LEN 4
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_LBN 32
> > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_WIDTH 32
> > +
> > /* MC_CMD_GET_LINK_OUT msgresponse */
> > #define MC_CMD_GET_LINK_OUT_LEN 28
> > /* Near-side advertised capabilities. Refer to
> > @@ -5969,6 +6501,94 @@
> > #define MC_CMD_SET_LINK_IN_V2_MODULE_SEQ_IGNORE_LBN 7
> > #define MC_CMD_SET_LINK_IN_V2_MODULE_SEQ_IGNORE_WIDTH 1
> >
> > +/* MC_CMD_SET_LINK_IN_V3 msgrequest */
> > +#define MC_CMD_SET_LINK_IN_V3_LEN 28
> > +/* Near-side advertised capabilities. Refer to
> > + * MC_CMD_GET_PHY_CFG_OUT/SUPPORTED_CAP for bit definitions.
> > + */
> > +#define MC_CMD_SET_LINK_IN_V3_CAP_OFST 0
> > +#define MC_CMD_SET_LINK_IN_V3_CAP_LEN 4
> > +/* Flags */
> > +#define MC_CMD_SET_LINK_IN_V3_FLAGS_OFST 4
> > +#define MC_CMD_SET_LINK_IN_V3_FLAGS_LEN 4
> > +#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_OFST 4
> > +#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_LBN 0
> > +#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_WIDTH 1
> > +#define MC_CMD_SET_LINK_IN_V3_POWEROFF_OFST 4
> > +#define MC_CMD_SET_LINK_IN_V3_POWEROFF_LBN 1
> > +#define MC_CMD_SET_LINK_IN_V3_POWEROFF_WIDTH 1
> > +#define MC_CMD_SET_LINK_IN_V3_TXDIS_OFST 4
> > +#define MC_CMD_SET_LINK_IN_V3_TXDIS_LBN 2
> > +#define MC_CMD_SET_LINK_IN_V3_TXDIS_WIDTH 1
> > +#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_OFST 4
> > +#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_LBN 3
> > +#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_WIDTH 1
> > +/* Loopback mode. */
> > +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_MODE_OFST 8
> > +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_MODE_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MC_CMD_GET_LOOPBACK_MODES/MC_CMD_GET_LOOPBACK_MODES_OUT/100M */
> > +/* A loopback speed of "0" is supported, and means (choose any available
> > + * speed).
> > + */
> > +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_SPEED_OFST 12
> > +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_SPEED_LEN 4
> > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_OFST 16
> > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_LEN 1
> > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_OFST 16
> > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_LBN 0
> > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_WIDTH 7
> > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_OFST 16
> > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_LBN 7
> > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_WIDTH 1
> > +/* Padding */
> > +#define MC_CMD_SET_LINK_IN_V3_RESERVED_OFST 17
> > +#define MC_CMD_SET_LINK_IN_V3_RESERVED_LEN 3
> > +/* Target port to set link state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > + * identifies a real or virtual network port by MAE port and link end. See the
> > + * structure definition for more details
> > + */
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_OFST 20
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LEN 8
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_OFST 20
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_LEN 4
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_LBN 160
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_WIDTH 32
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_OFST 24
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_LEN 4
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_LBN 192
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_WIDTH 32
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_OFST 20
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_LEN 4
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FLAT_OFST 20
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_TYPE_OFST 23
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 20
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 160
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 180
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 176
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 22
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 20
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LINK_END_OFST 24
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LINK_END_LEN 4
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_OFST 20
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LEN 8
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_OFST 20
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_LEN 4
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_LBN 160
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_WIDTH 32
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_OFST 24
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_LEN 4
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_LBN 192
> > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_WIDTH 32
> > +
> > /* MC_CMD_SET_LINK_OUT msgresponse */
> > #define MC_CMD_SET_LINK_OUT_LEN 0
> >
> > @@ -6188,19 +6808,9 @@
> > #define MC_CMD_SET_MAC_V3_IN_CFG_FCS_OFST 28
> > #define MC_CMD_SET_MAC_V3_IN_CFG_FCS_LBN 4
> > #define MC_CMD_SET_MAC_V3_IN_CFG_FCS_WIDTH 1
> > -/* Identifies the MAC to update by the specifying the end of a logical MAE
> > - * link. Setting TARGET to MAE_LINK_ENDPOINT_COMPAT is equivalent to using the
> > - * previous version of the command (MC_CMD_SET_MAC_EXT). Not all possible
> > - * combinations of MPORT_END and MPORT_SELECTOR in TARGET will work in all
> > - * circumstances. 1. Some will always work (e.g. a VF can always address its
> > - * logical MAC using MPORT_SELECTOR=ASSIGNED,LINK_END=VNIC), 2. Some are not
> > - * meaningful and will always fail with EINVAL (e.g. attempting to address the
> > - * VNIC end of a link to a physical port), 3. Some are meaningful but require
> > - * the MCDI client to have the required permission and fail with EPERM
> > - * otherwise (e.g. trying to set the MAC on a VF the caller cannot administer),
> > - * and 4. Some could be implementation-specific and fail with ENOTSUP if not
> > - * available (no examples exist right now). See SF-123581-TC section 4.3 for
> > - * more details.
> > +/* Target port to set mac state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > + * identifies a real or virtual network port by MAE port and link end. See the
> > + * structure definition for more details
> > */
> > #define MC_CMD_SET_MAC_V3_IN_TARGET_OFST 32
> > #define MC_CMD_SET_MAC_V3_IN_TARGET_LEN 8
> > @@ -6405,6 +7015,97 @@
> > #define MC_CMD_MAC_STATS_IN_PORT_ID_OFST 16
> > #define MC_CMD_MAC_STATS_IN_PORT_ID_LEN 4
> >
> > +/* MC_CMD_MAC_STATS_V2_IN msgrequest */
> > +#define MC_CMD_MAC_STATS_V2_IN_LEN 28
> > +/* ??? */
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_OFST 0
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LEN 8
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_OFST 0
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_LEN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_LBN 0
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_WIDTH 32
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_OFST 4
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_LEN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_LBN 32
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_WIDTH 32
> > +#define MC_CMD_MAC_STATS_V2_IN_CMD_OFST 8
> > +#define MC_CMD_MAC_STATS_V2_IN_CMD_LEN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_OFST 8
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_LBN 0
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_WIDTH 1
> > +#define MC_CMD_MAC_STATS_V2_IN_CLEAR_OFST 8
> > +#define MC_CMD_MAC_STATS_V2_IN_CLEAR_LBN 1
> > +#define MC_CMD_MAC_STATS_V2_IN_CLEAR_WIDTH 1
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_OFST 8
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_LBN 2
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_WIDTH 1
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_OFST 8
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_LBN 3
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_WIDTH 1
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_OFST 8
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_LBN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_WIDTH 1
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_OFST 8
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_LBN 5
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_WIDTH 1
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_OFST 8
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_LBN 16
> > +#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_WIDTH 16
> > +/* DMA length. Should be set to MAC_STATS_NUM_STATS * sizeof(uint64_t), as
> > + * returned by MC_CMD_GET_CAPABILITIES_V4_OUT. For legacy firmware not
> > + * supporting MC_CMD_GET_CAPABILITIES_V4_OUT, DMA_LEN should be set to
> > + * MC_CMD_MAC_NSTATS * sizeof(uint64_t)
> > + */
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_LEN_OFST 12
> > +#define MC_CMD_MAC_STATS_V2_IN_DMA_LEN_LEN 4
> > +/* port id so vadapter stats can be provided */
> > +#define MC_CMD_MAC_STATS_V2_IN_PORT_ID_OFST 16
> > +#define MC_CMD_MAC_STATS_V2_IN_PORT_ID_LEN 4
> > +/* Target port to request statistics for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > + * identifies a real or virtual network port by MAE port and link end. See the
> > + * structure definition for more details
> > + */
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_OFST 20
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LEN 8
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_OFST 20
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_LEN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_LBN 160
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_WIDTH 32
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_OFST 24
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_LEN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_LBN 192
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_WIDTH 32
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_OFST 20
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_LEN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FLAT_OFST 20
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_TYPE_OFST 23
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 20
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 160
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 180
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 176
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 22
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 20
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LINK_END_OFST 24
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LINK_END_LEN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_OFST 20
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LEN 8
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_OFST 20
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_LEN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_LBN 160
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_WIDTH 32
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_OFST 24
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_LEN 4
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_LBN 192
> > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_WIDTH 32
> > +
> > /* MC_CMD_MAC_STATS_OUT_DMA msgresponse */
> > #define MC_CMD_MAC_STATS_OUT_DMA_LEN 0
> >
> > @@ -7522,7 +8223,7 @@
> > #define MC_CMD_REBOOT 0x3d
> > #undef MC_CMD_0x3d_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x3d_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x3d_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_REBOOT_IN msgrequest */
> > #define MC_CMD_REBOOT_IN_LEN 4
> > @@ -8061,6 +8762,53 @@
> > /* MC_CMD_GET_PHY_STATE_IN msgrequest */
> > #define MC_CMD_GET_PHY_STATE_IN_LEN 0
> >
> > +/* MC_CMD_GET_PHY_STATE_IN_V2 msgrequest */
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_LEN 8
> > +/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > + * identifies a real or virtual network port by MAE port and link end. See the
> > + * structure definition for more details.
> > + */
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_OFST 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LEN 8
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_OFST 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_LEN 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_LBN 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_WIDTH 32
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_OFST 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_LEN 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_LBN 32
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_WIDTH 32
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LINK_END_OFST 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LINK_END_LEN 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_OFST 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LEN 8
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_OFST 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_LEN 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_LBN 0
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_WIDTH 32
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_OFST 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_LEN 4
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_LBN 32
> > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_WIDTH 32
> > +
> > /* MC_CMD_GET_PHY_STATE_OUT msgresponse */
> > #define MC_CMD_GET_PHY_STATE_OUT_LEN 4
> > #define MC_CMD_GET_PHY_STATE_OUT_STATE_OFST 0
> > @@ -8200,7 +8948,7 @@
> > #define MC_CMD_TESTASSERT 0x49
> > #undef MC_CMD_0x49_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x49_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x49_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_TESTASSERT_IN msgrequest */
> > #define MC_CMD_TESTASSERT_IN_LEN 0
> > @@ -8324,6 +9072,61 @@
> > #define MC_CMD_GET_PHY_MEDIA_INFO_IN_DSFP_BANK_LBN 16
> > #define MC_CMD_GET_PHY_MEDIA_INFO_IN_DSFP_BANK_WIDTH 16
> >
> > +/* MC_CMD_GET_PHY_MEDIA_INFO_IN_V2 msgrequest */
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_LEN 12
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_PAGE_OFST 0
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_PAGE_LEN 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_OFST 0
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_LBN 0
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_WIDTH 16
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_OFST 0
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_LBN 16
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_WIDTH 16
> > +/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > + * identifies a real or virtual network port by MAE port and link end. See the
> > + * structure definition for more details
> > + */
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_OFST 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LEN 8
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_OFST 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_LEN 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_LBN 32
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_WIDTH 32
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_OFST 8
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_LEN 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_LBN 64
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_WIDTH 32
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_OFST 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 7
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 32
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 52
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 48
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 6
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LINK_END_OFST 8
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LINK_END_LEN 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_OFST 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LEN 8
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_OFST 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_LEN 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_LBN 32
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_WIDTH 32
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_OFST 8
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_LEN 4
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_LBN 64
> > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_WIDTH 32
> > +
> > /* MC_CMD_GET_PHY_MEDIA_INFO_OUT msgresponse */
> > #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMIN 5
> > #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMAX 252
> > @@ -8348,7 +9151,7 @@
> > #define MC_CMD_NVRAM_TEST 0x4c
> > #undef MC_CMD_0x4c_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x4c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x4c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_NVRAM_TEST_IN msgrequest */
> > #define MC_CMD_NVRAM_TEST_IN_LEN 4
> > @@ -8593,7 +9396,7 @@
> > #define MC_CMD_CLP 0x56
> > #undef MC_CMD_0x56_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x56_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x56_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_CLP_IN msgrequest */
> > #define MC_CMD_CLP_IN_LEN 4
> > @@ -9500,27 +10303,22 @@
> > * and a generation count for this version of the sensor table. On systems
> > * advertising the DYNAMIC_SENSORS capability bit, this replaces the
> > * MC_CMD_READ_SENSORS command. On multi-MC systems this may include sensors
> > - * added by the NMC.
> > - *
> > - * Sensor handles are persistent for the lifetime of the sensor and are used to
> > - * identify sensors in MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS and
> > - * MC_CMD_DYNAMIC_SENSORS_GET_VALUES.
> > - *
> > - * The generation count is maintained by the MC, is persistent across reboots
> > - * and will be incremented each time the sensor table is modified. When the
> > - * table is modified, a CODE_DYNAMIC_SENSORS_CHANGE event will be generated
> > - * containing the new generation count. The driver should compare this against
> > - * the current generation count, and if it is different, call
> > - * MC_CMD_DYNAMIC_SENSORS_LIST again to update it's copy of the sensor table.
> > - *
> > - * The sensor count is provided to allow a future path to supporting more than
> > + * added by the NMC. Sensor handles are persistent for the lifetime of the
> > + * sensor and are used to identify sensors in
> > + * MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS and
> > + * MC_CMD_DYNAMIC_SENSORS_GET_VALUES. The generation count is maintained by the
> > + * MC, is persistent across reboots and will be incremented each time the
> > + * sensor table is modified. When the table is modified, a
> > + * CODE_DYNAMIC_SENSORS_CHANGE event will be generated containing the new
> > + * generation count. The driver should compare this against the current
> > + * generation count, and if it is different, call MC_CMD_DYNAMIC_SENSORS_LIST
> > + * again to update it's copy of the sensor table. The sensor count is provided
> > + * to allow a future path to supporting more than
> > * MC_CMD_DYNAMIC_SENSORS_GET_READINGS_IN_HANDLES_MAXNUM_MCDI2 sensors, i.e.
> > * the maximum number that will fit in a single response. As this is a fairly
> > * large number (253) it is not anticipated that this will be needed in the
> > - * near future, so can currently be ignored.
> > - *
> > - * On Riverhead this command is implemented as a wrapper for `list` in the
> > - * sensor_query SPHINX service.
> > + * near future, so can currently be ignored. On Riverhead this command is
> > + * implemented as a wrapper for `list` in the sensor_query SPHINX service.
> > */
> > #define MC_CMD_DYNAMIC_SENSORS_LIST 0x66
> > #undef MC_CMD_0x66_PRIVILEGE_CTG
> > @@ -9557,15 +10355,13 @@
> > /***********************************/
> > /* MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS
> > * Get descriptions for a set of sensors, specified as an array of sensor
> > - * handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST
> > - *
> > - * Any handles which do not correspond to a sensor currently managed by the MC
> > - * will be dropped from from the response. This may happen when a sensor table
> > - * update is in progress, and effectively means the set of usable sensors is
> > - * the intersection between the sets of sensors known to the driver and the MC.
> > - *
> > - * On Riverhead this command is implemented as a wrapper for
> > - * `get_descriptions` in the sensor_query SPHINX service.
> > + * handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST. Any handles which do not
> > + * correspond to a sensor currently managed by the MC will be dropped from from
> > + * the response. This may happen when a sensor table update is in progress, and
> > + * effectively means the set of usable sensors is the intersection between the
> > + * sets of sensors known to the driver and the MC. On Riverhead this command is
> > + * implemented as a wrapper for `get_descriptions` in the sensor_query SPHINX
> > + * service.
> > */
> > #define MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS 0x67
> > #undef MC_CMD_0x67_PRIVILEGE_CTG
> > @@ -9602,19 +10398,15 @@
> > /***********************************/
> > /* MC_CMD_DYNAMIC_SENSORS_GET_READINGS
> > * Read the state and value for a set of sensors, specified as an array of
> > - * sensor handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST.
> > - *
> > - * In the case of a broken sensor, then the state of the response's
> > - * MC_CMD_DYNAMIC_SENSORS_VALUE entry will be set to BROKEN, and any value
> > - * provided should be treated as erroneous.
> > - *
> > - * Any handles which do not correspond to a sensor currently managed by the MC
> > - * will be dropped from from the response. This may happen when a sensor table
> > - * update is in progress, and effectively means the set of usable sensors is
> > - * the intersection between the sets of sensors known to the driver and the MC.
> > - *
> > - * On Riverhead this command is implemented as a wrapper for `get_readings`
> > - * in the sensor_query SPHINX service.
> > + * sensor handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST. In the case of a
> > + * broken sensor, then the state of the response's MC_CMD_DYNAMIC_SENSORS_VALUE
> > + * entry will be set to BROKEN, and any value provided should be treated as
> > + * erroneous. Any handles which do not correspond to a sensor currently managed
> > + * by the MC will be dropped from from the response. This may happen when a
> > + * sensor table update is in progress, and effectively means the set of usable
> > + * sensors is the intersection between the sets of sensors known to the driver
> > + * and the MC. On Riverhead this command is implemented as a wrapper for
> > + * `get_readings` in the sensor_query SPHINX service.
> > */
> > #define MC_CMD_DYNAMIC_SENSORS_GET_READINGS 0x68
> > #undef MC_CMD_0x68_PRIVILEGE_CTG
> > @@ -10212,6 +11004,42 @@
> > #define CTPIO_STATS_MAP_BUCKET_LBN 16
> > #define CTPIO_STATS_MAP_BUCKET_WIDTH 16
> >
> > +/* MESSAGE_TYPE structuredef: When present this defines the meaning of a
> > + * message, and is used to protect against chosen message attacks in signed
> > + * messages, regardless their origin. The message type also defines the
> > + * signature cryptographic algorithm, encoding, and message fields included in
> > + * the signature. The values are used in different commands but must be unique
> > + * across all commands, e.g. MC_CMD_TSA_BIND_IN_SECURE_UNBIND uses different
> > + * message type than MC_CMD_SECURE_NIC_INFO_IN_STATUS.
> > + */
> > +#define MESSAGE_TYPE_LEN 4
> > +#define MESSAGE_TYPE_MESSAGE_TYPE_OFST 0
> > +#define MESSAGE_TYPE_MESSAGE_TYPE_LEN 4
> > +#define MESSAGE_TYPE_UNUSED 0x0 /* enum */
> > +/* enum: Message type value for the response to a
> > + * MC_CMD_TSA_BIND_IN_SECURE_UNBIND message. TSA_SECURE_UNBIND messages are
> > + * ECDSA SECP384R1 signed using SHA384 message digest algorithm over fields
> > + * MESSAGE_TYPE, TSANID, TSAID, and UNBINDTOKEN, and encoded as suggested by
> > + * RFC6979 (section 2.4).
> > + */
> > +#define MESSAGE_TYPE_TSA_SECURE_UNBIND 0x1
> > +/* enum: Message type value for the response to a
> > + * MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION message. TSA_SECURE_DECOMMISSION
> > + * messages are ECDSA SECP384R1 signed using SHA384 message digest algorithm
> > + * over fields MESSAGE_TYPE, TSAID, USER, and REASON, and encoded as suggested
> > + * by RFC6979 (section 2.4).
> > + */
> > +#define MESSAGE_TYPE_TSA_SECURE_DECOMMISSION 0x2
> > +/* enum: Message type value for the response to a
> > + * MC_CMD_SECURE_NIC_INFO_IN_STATUS message. This enum value is not sequential
> > + * to other message types for backwards compatibility as the message type for
> > + * MC_CMD_SECURE_NIC_INFO_IN_STATUS was defined before the existence of this
> > + * global enum.
> > + */
> > +#define MESSAGE_TYPE_SECURE_NIC_INFO_STATUS 0xdb4
> > +#define MESSAGE_TYPE_MESSAGE_TYPE_LBN 0
> > +#define MESSAGE_TYPE_MESSAGE_TYPE_WIDTH 32
> > +
> >
> > /***********************************/
> > /* MC_CMD_READ_REGS
> > @@ -12860,6 +13688,48 @@
> > #define MC_CMD_GET_PARSER_DISP_RESTRICTIONS_OUT_DST_IP_MCAST_ONLY_LBN 0
> > #define MC_CMD_GET_PARSER_DISP_RESTRICTIONS_OUT_DST_IP_MCAST_ONLY_WIDTH 1
> >
> > +/* MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT msgresponse:
> > + * GET_PARSER_DISP_INFO response format for OP_GET_SECURITY_RULE_INFO.
> > + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
> > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > + * been used in any released code and may change during development. This note
> > + * will be removed once it is regarded as stable.
> > + */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_LEN 36
> > +/* identifies the type of operation requested */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_OP_OFST 0
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_OP_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MC_CMD_GET_PARSER_DISP_INFO_IN/OP */
> > +/* a version number representing the set of rule lookups that are implemented
> > + * by the currently running firmware
> > + */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_OFST 4
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_LEN 4
> > +/* enum: implements lookup sequences described in SF-114946-SW draft C */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_SF_114946_SW_C 0x0
> > +/* the number of nodes in the subnet map */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_NODES_OFST 8
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_NODES_LEN 4
> > +/* the number of entries in one subnet map node */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_ENTRIES_PER_NODE_OFST 12
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_ENTRIES_PER_NODE_LEN 4
> > +/* minimum valid value for a subnet ID in a subnet map leaf */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MIN_OFST 16
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MIN_LEN 4
> > +/* maximum valid value for a subnet ID in a subnet map leaf */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MAX_OFST 20
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MAX_LEN 4
> > +/* the number of entries in the local and remote port range maps */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_TREE_NUM_ENTRIES_OFST 24
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_TREE_NUM_ENTRIES_LEN 4
> > +/* minimum valid value for a portrange ID in a port range map leaf */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MIN_OFST 28
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MIN_LEN 4
> > +/* maximum valid value for a portrange ID in a port range map leaf */
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MAX_OFST 32
> > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MAX_LEN 4
> > +
> > /* MC_CMD_GET_PARSER_DISP_VNIC_ENCAP_MATCHES_OUT msgresponse: This response is
> > * returned if a MC_CMD_GET_PARSER_DISP_INFO_IN request is sent with OP value
> > * OP_GET_SUPPORTED_VNIC_ENCAP_MATCHES. It contains information about the
> > @@ -13716,7 +14586,7 @@
> > #define MC_CMD_SATELLITE_DOWNLOAD 0x91
> > #undef MC_CMD_0x91_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x91_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x91_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_SATELLITE_DOWNLOAD_IN msgrequest: The reset requirements for the CPUs
> > * are subtle, and so downloads must proceed in a number of phases.
> > @@ -13835,10 +14705,9 @@
> >
> > /***********************************/
> > /* MC_CMD_GET_CAPABILITIES
> > - * Get device capabilities.
> > - *
> > - * This is supplementary to the MC_CMD_GET_BOARD_CFG command, and intended to
> > - * reference inherent device capabilities as opposed to current NVRAM config.
> > + * Get device capabilities. This is supplementary to the MC_CMD_GET_BOARD_CFG
> > + * command, and intended to reference inherent device capabilities as opposed
> > + * to current NVRAM config.
> > */
> > #define MC_CMD_GET_CAPABILITIES 0xbe
> > #undef MC_CMD_0xbe_PRIVILEGE_CTG
> > @@ -16796,9 +17665,15 @@
> > #define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
> > #define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
> > #define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
> > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
> > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
> > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
> > #define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
> > #define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
> > #define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
> > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_OFST 148
> > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_LBN 15
> > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
> >
> > /* MC_CMD_GET_CAPABILITIES_V8_OUT msgresponse */
> > #define MC_CMD_GET_CAPABILITIES_V8_OUT_LEN 160
> > @@ -17300,9 +18175,15 @@
> > #define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
> > #define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
> > #define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
> > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
> > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
> > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
> > #define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
> > #define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
> > #define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
> > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_OFST 148
> > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_LBN 15
> > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
> > /* These bits are reserved for communicating test-specific capabilities to
> > * host-side test software. All production drivers should treat this field as
> > * opaque.
> > @@ -17818,9 +18699,15 @@
> > #define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
> > #define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
> > #define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
> > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
> > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
> > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
> > #define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
> > #define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
> > #define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
> > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_OFST 148
> > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_LBN 15
> > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
> > /* These bits are reserved for communicating test-specific capabilities to
> > * host-side test software. All production drivers should treat this field as
> > * opaque.
> > @@ -18371,9 +19258,15 @@
> > #define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
> > #define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
> > #define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
> > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
> > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
> > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
> > #define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
> > #define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
> > #define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
> > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_OFST 148
> > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_LBN 15
> > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
> > /* These bits are reserved for communicating test-specific capabilities to
> > * host-side test software. All production drivers should treat this field as
> > * opaque.
> > @@ -18468,6 +19361,13 @@
> > * are not defined.
> > */
> > #define MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_TSA 0x1
> > +/* enum: MCDI command used for platform management. Typically, these commands
> > + * are used for low-level operations directed at the platform as a whole (e.g.
> > + * MMIO device enumeration) rather than individual functions and use a
> > + * dedicated comms channel (e.g. RPmsg/IPI). May be handled by the same or
> > + * different CPU as MCDI_MESSAGE_TYPE_MC.
> > + */
> > +#define MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_PLATFORM 0x2
> >
> >
> > /***********************************/
> > @@ -20179,7 +21079,7 @@
> > #define MC_CMD_SHMBOOT_OP 0xe6
> > #undef MC_CMD_0xe6_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0xe6_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0xe6_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_SHMBOOT_OP_IN msgrequest */
> > #define MC_CMD_SHMBOOT_OP_IN_LEN 4
> > @@ -20448,7 +21348,7 @@
> > #define MC_CMD_ENABLE_OFFLINE_BIST 0xed
> > #undef MC_CMD_0xed_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0xed_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0xed_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_ENABLE_OFFLINE_BIST_IN msgrequest */
> > #define MC_CMD_ENABLE_OFFLINE_BIST_IN_LEN 0
> > @@ -20588,7 +21488,7 @@
> > #define MC_CMD_KR_TUNE 0xf1
> > #undef MC_CMD_0xf1_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0xf1_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0xf1_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_KR_TUNE_IN msgrequest */
> > #define MC_CMD_KR_TUNE_IN_LENMIN 4
> > @@ -21144,7 +22044,7 @@
> > #define MC_CMD_PCIE_TUNE 0xf2
> > #undef MC_CMD_0xf2_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0xf2_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0xf2_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_PCIE_TUNE_IN msgrequest */
> > #define MC_CMD_PCIE_TUNE_IN_LENMIN 4
> > @@ -21877,7 +22777,7 @@
> > #define MC_CMD_LICENSING_V3_TEMPORARY 0xd6
> > #undef MC_CMD_0xd6_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0xd6_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0xd6_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_LICENSING_V3_TEMPORARY_IN msgrequest */
> > #define MC_CMD_LICENSING_V3_TEMPORARY_IN_LEN 4
> > @@ -22305,8 +23205,8 @@
> > * TLV_PORT_MODE_*). A superset of MC_CMD_GET_PORT_MODES_OUT/MODES that
> > * contains all modes implemented in firmware for a particular board. Modes
> > * listed in MODES are considered production modes and should be exposed in
> > - * userland tools. Modes listed in ENGINEERING_MODES, but not in MODES
> > - * should be considered hidden (not to be exposed in userland tools) and for
> > + * userland tools. Modes listed in ENGINEERING_MODES, but not in MODES should
> > + * be considered hidden (not to be exposed in userland tools) and for
> > * engineering use only. There are no other semantic differences and any mode
> > * listed in either MODES or ENGINEERING_MODES can be set on the board.
> > */
> > @@ -22937,7 +23837,7 @@
> > #define MC_CMD_EXEC_SIGNED 0x10c
> > #undef MC_CMD_0x10c_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x10c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x10c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_EXEC_SIGNED_IN msgrequest */
> > #define MC_CMD_EXEC_SIGNED_IN_LEN 28
> > @@ -22967,7 +23867,7 @@
> > #define MC_CMD_PREPARE_SIGNED 0x10d
> > #undef MC_CMD_0x10d_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x10d_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x10d_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_PREPARE_SIGNED_IN msgrequest */
> > #define MC_CMD_PREPARE_SIGNED_IN_LEN 4
> > @@ -22979,6 +23879,445 @@
> > #define MC_CMD_PREPARE_SIGNED_OUT_LEN 0
> >
> >
> > +/***********************************/
> > +/* MC_CMD_SET_SECURITY_RULE
> > + * Set blacklist and/or whitelist action for a particular match criteria.
> > + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
> > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > + * been used in any released code and may change during development. This note
> > + * will be removed once it is regarded as stable.
> > + */
> > +#define MC_CMD_SET_SECURITY_RULE 0x10f
> > +#undef MC_CMD_0x10f_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x10f_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_SET_SECURITY_RULE_IN msgrequest */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_LEN 92
> > +/* fields to include in match criteria */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_FIELDS_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_FIELDS_LEN 4
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_LBN 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_LBN 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_LBN 2
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_LBN 3
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_LBN 4
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_LBN 5
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_LBN 6
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_LBN 7
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_LBN 8
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_LBN 9
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_LBN 10
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_LBN 11
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_LBN 12
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_LBN 13
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_LBN 14
> > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_WIDTH 1
> > +/* remote MAC address to match (as bytes in network order) */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_MAC_OFST 4
> > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_MAC_LEN 6
> > +/* remote port to match (as bytes in network order) */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORT_OFST 10
> > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORT_LEN 2
> > +/* local MAC address to match (as bytes in network order) */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_MAC_OFST 12
> > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_MAC_LEN 6
> > +/* local port to match (as bytes in network order) */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORT_OFST 18
> > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORT_LEN 2
> > +/* Ethernet type to match (as bytes in network order) */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_ETHER_TYPE_OFST 20
> > +#define MC_CMD_SET_SECURITY_RULE_IN_ETHER_TYPE_LEN 2
> > +/* Inner VLAN tag to match (as bytes in network order) */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_INNER_VLAN_OFST 22
> > +#define MC_CMD_SET_SECURITY_RULE_IN_INNER_VLAN_LEN 2
> > +/* Outer VLAN tag to match (as bytes in network order) */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_OUTER_VLAN_OFST 24
> > +#define MC_CMD_SET_SECURITY_RULE_IN_OUTER_VLAN_LEN 2
> > +/* IP protocol to match (in low byte; set high byte to 0) */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_IP_PROTO_OFST 26
> > +#define MC_CMD_SET_SECURITY_RULE_IN_IP_PROTO_LEN 2
> > +/* Physical port to match (as little-endian 32-bit value) */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_PHYSICAL_PORT_OFST 28
> > +#define MC_CMD_SET_SECURITY_RULE_IN_PHYSICAL_PORT_LEN 4
> > +/* Reserved; set to 0 */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_RESERVED_OFST 32
> > +#define MC_CMD_SET_SECURITY_RULE_IN_RESERVED_LEN 4
> > +/* remote IP address to match (as bytes in network order; set last 12 bytes to
> > + * 0 for IPv4 address)
> > + */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_IP_OFST 36
> > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_IP_LEN 16
> > +/* local IP address to match (as bytes in network order; set last 12 bytes to 0
> > + * for IPv4 address)
> > + */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_IP_OFST 52
> > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_IP_LEN 16
> > +/* remote subnet ID to match (as little-endian 32-bit value); note that remote
> > + * subnets are matched by mapping the remote IP address to a "subnet ID" via a
> > + * data structure which must already have been configured using
> > + * MC_CMD_SUBNET_MAP_SET_NODE appropriately
> > + */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_SUBNET_ID_OFST 68
> > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_SUBNET_ID_LEN 4
> > +/* remote portrange ID to match (as little-endian 32-bit value); note that
> > + * remote port ranges are matched by mapping the remote port to a "portrange
> > + * ID" via a data structure which must already have been configured using
> > + * MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE
> > + */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORTRANGE_ID_OFST 72
> > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORTRANGE_ID_LEN 4
> > +/* local portrange ID to match (as little-endian 32-bit value); note that local
> > + * port ranges are matched by mapping the local port to a "portrange ID" via a
> > + * data structure which must already have been configured using
> > + * MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE
> > + */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORTRANGE_ID_OFST 76
> > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORTRANGE_ID_LEN 4
> > +/* set the action for transmitted packets matching this rule */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_OFST 80
> > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_LEN 4
> > +/* enum: make no decision */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_NONE 0x0
> > +/* enum: decide to accept the packet */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_WHITELIST 0x1
> > +/* enum: decide to drop the packet */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_BLACKLIST 0x2
> > +/* enum: inform the TSA controller about some sample of packets matching this
> > + * rule (via MC_CMD_TSA_INFO_IN_PKT_SAMPLE messages); may be bitwise-ORed with
> > + * either the WHITELIST or BLACKLIST action
> > + */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_SAMPLE 0x4
> > +/* enum: do not change the current TX action */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_UNCHANGED 0xffffffff
> > +/* set the action for received packets matching this rule */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_OFST 84
> > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_LEN 4
> > +/* enum: make no decision */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_NONE 0x0
> > +/* enum: decide to accept the packet */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_WHITELIST 0x1
> > +/* enum: decide to drop the packet */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_BLACKLIST 0x2
> > +/* enum: inform the TSA controller about some sample of packets matching this
> > + * rule (via MC_CMD_TSA_INFO_IN_PKT_SAMPLE messages); may be bitwise-ORed with
> > + * either the WHITELIST or BLACKLIST action
> > + */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_SAMPLE 0x4
> > +/* enum: do not change the current RX action */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_UNCHANGED 0xffffffff
> > +/* counter ID to associate with this rule; IDs are allocated using
> > + * MC_CMD_SECURITY_RULE_COUNTER_ALLOC
> > + */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_OFST 88
> > +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_LEN 4
> > +/* enum: special value for the null counter ID */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_NONE 0x0
> > +/* enum: special value to tell the MC to allocate an available counter */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_SW_AUTO 0xeeeeeeee
> > +/* enum: special value to request use of hardware counter (Medford2 only) */
> > +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_HW 0xffffffff
> > +
> > +/* MC_CMD_SET_SECURITY_RULE_OUT msgresponse */
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_LEN 32
> > +/* new reference count for uses of counter ID */
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_REFCNT_OFST 0
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_REFCNT_LEN 4
> > +/* constructed match bits for this rule (as a tracing aid only) */
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_MATCH_BITS_OFST 4
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_MATCH_BITS_LEN 12
> > +/* constructed discriminator bits for this rule (as a tracing aid only) */
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_DISCRIMINATOR_OFST 16
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_DISCRIMINATOR_LEN 4
> > +/* base location for probes for this rule (as a tracing aid only) */
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_BASE_OFST 20
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_BASE_LEN 4
> > +/* step for probes for this rule (as a tracing aid only) */
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_STEP_OFST 24
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_STEP_LEN 4
> > +/* ID for reading back the counter */
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_ID_OFST 28
> > +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_ID_LEN 4
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_RESET_SECURITY_RULES
> > + * Reset all blacklist and whitelist actions for a particular physical port, or
> > + * all ports. (Medford-only; for use by SolarSecure apps, not directly by
> > + * drivers. See SF-114946-SW.) NOTE - this message definition is provisional.
> > + * It has not yet been used in any released code and may change during
> > + * development. This note will be removed once it is regarded as stable.
> > + */
> > +#define MC_CMD_RESET_SECURITY_RULES 0x110
> > +#undef MC_CMD_0x110_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x110_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_RESET_SECURITY_RULES_IN msgrequest */
> > +#define MC_CMD_RESET_SECURITY_RULES_IN_LEN 4
> > +/* index of physical port to reset (or ALL_PHYSICAL_PORTS to reset all) */
> > +#define MC_CMD_RESET_SECURITY_RULES_IN_PHYSICAL_PORT_OFST 0
> > +#define MC_CMD_RESET_SECURITY_RULES_IN_PHYSICAL_PORT_LEN 4
> > +/* enum: special value to reset all physical ports */
> > +#define MC_CMD_RESET_SECURITY_RULES_IN_ALL_PHYSICAL_PORTS 0xffffffff
> > +
> > +/* MC_CMD_RESET_SECURITY_RULES_OUT msgresponse */
> > +#define MC_CMD_RESET_SECURITY_RULES_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_GET_SECURITY_RULESET_VERSION
> > + * Return a large hash value representing a "version" of the complete set of
> > + * currently active blacklist / whitelist rules and associated data structures.
> > + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
> > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > + * been used in any released code and may change during development. This note
> > + * will be removed once it is regarded as stable.
> > + */
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION 0x111
> > +#undef MC_CMD_0x111_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x111_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_GET_SECURITY_RULESET_VERSION_IN msgrequest */
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_IN_LEN 0
> > +
> > +/* MC_CMD_GET_SECURITY_RULESET_VERSION_OUT msgresponse */
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMIN 1
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMAX 252
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMAX_MCDI2 1020
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LEN(num) (0+1*(num))
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_NUM(len) (((len)-0)/1)
> > +/* Opaque hash value; length may vary depending on the hash scheme used */
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_OFST 0
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_LEN 1
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MINNUM 1
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MAXNUM 252
> > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MAXNUM_MCDI2 1020
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC
> > + * Allocate counters for use with blacklist / whitelist rules. (Medford-only;
> > + * for use by SolarSecure apps, not directly by drivers. See SF-114946-SW.)
> > + * NOTE - this message definition is provisional. It has not yet been used in
> > + * any released code and may change during development. This note will be
> > + * removed once it is regarded as stable.
> > + */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC 0x112
> > +#undef MC_CMD_0x112_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x112_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN msgrequest */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_LEN 4
> > +/* the number of new counter IDs to request */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_NUM_COUNTERS_OFST 0
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_NUM_COUNTERS_LEN 4
> > +
> > +/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT msgresponse */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMIN 4
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMAX 252
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMAX_MCDI2 1020
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LEN(num) (4+4*(num))
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_NUM(len) (((len)-4)/4)
> > +/* the number of new counter IDs allocated (may be less than the number
> > + * requested if resources are unavailable)
> > + */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_NUM_COUNTERS_OFST 0
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_NUM_COUNTERS_LEN 4
> > +/* new counter ID(s) */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_OFST 4
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_LEN 4
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MINNUM 0
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM 62
> > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM_MCDI2 254
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_SECURITY_RULE_COUNTER_FREE
> > + * Allocate counters for use with blacklist / whitelist rules. (Medford-only;
> > + * for use by SolarSecure apps, not directly by drivers. See SF-114946-SW.)
> > + * NOTE - this message definition is provisional. It has not yet been used in
> > + * any released code and may change during development. This note will be
> > + * removed once it is regarded as stable.
> > + */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE 0x113
> > +#undef MC_CMD_0x113_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x113_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_SECURITY_RULE_COUNTER_FREE_IN msgrequest */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMIN 4
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMAX 252
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMAX_MCDI2 1020
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LEN(num) (4+4*(num))
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_NUM(len) (((len)-4)/4)
> > +/* the number of counter IDs to free */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_NUM_COUNTERS_OFST 0
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_NUM_COUNTERS_LEN 4
> > +/* the counter ID(s) to free */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_OFST 4
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_LEN 4
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MINNUM 0
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MAXNUM 62
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MAXNUM_MCDI2 254
> > +
> > +/* MC_CMD_SECURITY_RULE_COUNTER_FREE_OUT msgresponse */
> > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_SUBNET_MAP_SET_NODE
> > + * Atomically update a trie node in the map of subnets to subnet IDs. The
> > + * constants in the descriptions of the fields of this message may be retrieved
> > + * by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO. (Medford-
> > + * only; for use by SolarSecure apps, not directly by drivers. See
> > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > + * been used in any released code and may change during development. This note
> > + * will be removed once it is regarded as stable.
> > + */
> > +#define MC_CMD_SUBNET_MAP_SET_NODE 0x114
> > +#undef MC_CMD_0x114_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x114_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_SUBNET_MAP_SET_NODE_IN msgrequest */
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMIN 6
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMAX 252
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMAX_MCDI2 1020
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LEN(num) (4+2*(num))
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_NUM(len) (((len)-4)/2)
> > +/* node to update in the range 0 .. SUBNET_MAP_NUM_NODES-1 */
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_NODE_ID_OFST 0
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_NODE_ID_LEN 4
> > +/* SUBNET_MAP_NUM_ENTRIES_PER_NODE new entries; each entry is either a pointer
> > + * to the next node, expressed as an offset in the trie memory (i.e. node ID
> > + * multiplied by SUBNET_MAP_NUM_ENTRIES_PER_NODE), or a leaf value in the range
> > + * SUBNET_ID_MIN .. SUBNET_ID_MAX
> > + */
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_OFST 4
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_LEN 2
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MINNUM 1
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MAXNUM 124
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MAXNUM_MCDI2 508
> > +
> > +/* MC_CMD_SUBNET_MAP_SET_NODE_OUT msgresponse */
> > +#define MC_CMD_SUBNET_MAP_SET_NODE_OUT_LEN 0
> > +
> > +/* PORTRANGE_TREE_ENTRY structuredef */
> > +#define PORTRANGE_TREE_ENTRY_LEN 4
> > +/* key for branch nodes (<= key takes left branch, > key takes right branch),
> > + * or magic value for leaf nodes
> > + */
> > +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_OFST 0
> > +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_LEN 2
> > +#define PORTRANGE_TREE_ENTRY_LEAF_NODE_KEY 0xffff /* enum */
> > +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_LBN 0
> > +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_WIDTH 16
> > +/* final portrange ID for leaf nodes (don't care for branch nodes) */
> > +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_OFST 2
> > +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_LEN 2
> > +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_LBN 16
> > +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_WIDTH 16
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE
> > + * Atomically update the entire tree mapping remote port ranges to portrange
> > + * IDs. The constants in the descriptions of the fields of this message may be
> > + * retrieved by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO.
> > + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
> > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > + * been used in any released code and may change during development. This note
> > + * will be removed once it is regarded as stable.
> > + */
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE 0x115
> > +#undef MC_CMD_0x115_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x115_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN msgrequest */
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMIN 4
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMAX 252
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMAX_MCDI2 1020
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LEN(num) (0+4*(num))
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_NUM(len) (((len)-0)/4)
> > +/* PORTRANGE_TREE_NUM_ENTRIES new entries, each laid out as a
> > + * PORTRANGE_TREE_ENTRY
> > + */
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_OFST 0
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_LEN 4
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MINNUM 1
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM 63
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM_MCDI2 255
> > +
> > +/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_OUT msgresponse */
> > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE
> > + * Atomically update the entire tree mapping remote port ranges to portrange
> > + * IDs. The constants in the descriptions of the fields of this message may be
> > + * retrieved by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO.
> > + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
> > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > + * been used in any released code and may change during development. This note
> > + * will be removed once it is regarded as stable.
> > + */
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE 0x116
> > +#undef MC_CMD_0x116_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x116_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN msgrequest */
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMIN 4
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMAX 252
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMAX_MCDI2 1020
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LEN(num) (0+4*(num))
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_NUM(len) (((len)-0)/4)
> > +/* PORTRANGE_TREE_NUM_ENTRIES new entries, each laid out as a
> > + * PORTRANGE_TREE_ENTRY
> > + */
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_OFST 0
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_LEN 4
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MINNUM 1
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM 63
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM_MCDI2 255
> > +
> > +/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_OUT msgresponse */
> > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_OUT_LEN 0
> > +
> > /* TUNNEL_ENCAP_UDP_PORT_ENTRY structuredef */
> > #define TUNNEL_ENCAP_UDP_PORT_ENTRY_LEN 4
> > /* UDP port (the standard ports are named below but any port may be used) */
> > @@ -23058,7 +24397,7 @@
> > #define MC_CMD_RX_BALANCING 0x118
> > #undef MC_CMD_0x118_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x118_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x118_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_RX_BALANCING_IN msgrequest */
> > #define MC_CMD_RX_BALANCING_IN_LEN 16
> > @@ -23079,6 +24418,627 @@
> > #define MC_CMD_RX_BALANCING_OUT_LEN 0
> >
> >
> > +/***********************************/
> > +/* MC_CMD_TSA_BIND
> > + * TSAN - TSAC binding communication protocol. Refer to SF-115479-TC for more
> > + * info in respect to the binding protocol.
> > + */
> > +#define MC_CMD_TSA_BIND 0x119
> > +#undef MC_CMD_0x119_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x119_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_TSA_BIND_IN msgrequest: Protocol operation code */
> > +#define MC_CMD_TSA_BIND_IN_LEN 4
> > +#define MC_CMD_TSA_BIND_IN_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_OP_LEN 4
> > +/* enum: Obsolete. Use MC_CMD_SECURE_NIC_INFO_IN_STATUS. */
> > +#define MC_CMD_TSA_BIND_OP_GET_ID 0x1
> > +/* enum: Get a binding ticket from the TSAN. The binding ticket is used as part
> > + * of the binding procedure to authorize the binding of an adapter to a TSAID.
> > + * Refer to SF-114946-SW for more information. This sub-command is only
> > + * available over a TLS secure connection between the TSAN and TSAC.
> > + */
> > +#define MC_CMD_TSA_BIND_OP_GET_TICKET 0x2
> > +/* enum: Opcode associated with the propagation of a private key that TSAN uses
> > + * as part of post-binding authentication procedure. More specifically, TSAN
> > + * uses this key for a signing operation. TSAC uses the counterpart public key
> > + * to verify the signature. Note - The post-binding authentication occurs when
> > + * the TSAN-TSAC connection terminates and TSAN tries to reconnect. Refer to
> > + * SF-114946-SW for more information. This sub-command is only available over a
> > + * TLS secure connection between the TSAN and TSAC.
> > + */
> > +#define MC_CMD_TSA_BIND_OP_SET_KEY 0x3
> > +/* enum: Request an insecure unbinding operation. This sub-command is available
> > + * for any privileged client.
> > + */
> > +#define MC_CMD_TSA_BIND_OP_UNBIND 0x4
> > +/* enum: Obsolete. Use MC_CMD_TSA_BIND_OP_SECURE_UNBIND. */
> > +#define MC_CMD_TSA_BIND_OP_UNBIND_EXT 0x5
> > +/* enum: Opcode associated with the propagation of the unbinding secret token.
> > + * TSAN persists the unbinding secret token. Refer to SF-115479-TC for more
> > + * information. This sub-command is only available over a TLS secure connection
> > + * between the TSAN and TSAC.
> > + */
> > +#define MC_CMD_TSA_BIND_OP_SET_UNBINDTOKEN 0x6
> > +/* enum: Obsolete. Use MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION. */
> > +#define MC_CMD_TSA_BIND_OP_DECOMMISSION 0x7
> > +/* enum: Obsolete. Use MC_CMD_GET_CERTIFICATE. */
> > +#define MC_CMD_TSA_BIND_OP_GET_CERTIFICATE 0x8
> > +/* enum: Request a secure unbinding operation using unbinding token. This sub-
> > + * command is available for any privileged client.
> > + */
> > +#define MC_CMD_TSA_BIND_OP_SECURE_UNBIND 0x9
> > +/* enum: Request a secure decommissioning operation. This sub-command is
> > + * available for any privileged client.
> > + */
> > +#define MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION 0xa
> > +/* enum: Test facility that allows an adapter to be configured to behave as if
> > + * Bound to a TSA controller with restricted MCDI administrator operations.
> > + * This operation is primarily intended to aid host driver development.
> > + */
> > +#define MC_CMD_TSA_BIND_OP_TEST_MCDI 0xb
> > +
> > +/* MC_CMD_TSA_BIND_IN_GET_ID msgrequest: Obsolete. Use
> > + * MC_CMD_SECURE_NIC_INFO_IN_STATUS.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_GET_ID_LEN 20
> > +/* The operation requested. */
> > +#define MC_CMD_TSA_BIND_IN_GET_ID_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_GET_ID_OP_LEN 4
> > +/* Cryptographic nonce that TSAC generates and sends to TSAN. TSAC generates
> > + * the nonce every time as part of the TSAN post-binding authentication
> > + * procedure when the TSAN-TSAC connection terminates and TSAN does need to re-
> > + * connect to the TSAC. Refer to SF-114946-SW for more information.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_GET_ID_NONCE_OFST 4
> > +#define MC_CMD_TSA_BIND_IN_GET_ID_NONCE_LEN 16
> > +
> > +/* MC_CMD_TSA_BIND_IN_GET_TICKET msgrequest */
> > +#define MC_CMD_TSA_BIND_IN_GET_TICKET_LEN 4
> > +/* The operation requested. */
> > +#define MC_CMD_TSA_BIND_IN_GET_TICKET_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_GET_TICKET_OP_LEN 4
> > +
> > +/* MC_CMD_TSA_BIND_IN_SET_KEY msgrequest */
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMIN 5
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMAX 252
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMAX_MCDI2 1020
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_LEN(num) (4+1*(num))
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_NUM(len) (((len)-4)/1)
> > +/* The operation requested. */
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_OP_LEN 4
> > +/* This data blob contains the private key generated by the TSAC. TSAN uses
> > + * this key for a signing operation. Note- This private key is used in
> > + * conjunction with the post-binding TSAN authentication procedure that occurs
> > + * when the TSAN-TSAC connection terminates and TSAN tries to reconnect. Refer
> > + * to SF-114946-SW for more information.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_OFST 4
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MINNUM 1
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MAXNUM 248
> > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MAXNUM_MCDI2 1016
> > +
> > +/* MC_CMD_TSA_BIND_IN_UNBIND msgrequest: Request an insecure unbinding
> > + * operation.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_LEN 10
> > +/* The operation requested. */
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_OP_LEN 4
> > +/* TSAN unique identifier for the network adapter */
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_OFST 4
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_LEN 6
> > +
> > +/* MC_CMD_TSA_BIND_IN_UNBIND_EXT msgrequest: Obsolete. Use
> > + * MC_CMD_TSA_BIND_IN_SECURE_UNBIND.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMIN 93
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMAX 252
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMAX_MCDI2 1020
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LEN(num) (92+1*(num))
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_NUM(len) (((len)-92)/1)
> > +/* The operation requested. */
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_OP_LEN 4
> > +/* TSAN unique identifier for the network adapter */
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_OFST 4
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_LEN 6
> > +/* Align the arguments to 32 bits */
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_RSVD_OFST 10
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_RSVD_LEN 2
> > +/* This attribute identifies the TSA infrastructure domain. The length of the
> > + * TSAID attribute is limited to 64 bytes. This is how TSA SDK defines the max
> > + * length. Note- The TSAID is the Organizational Unit Name filed as part of the
> > + * root and server certificates.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_OFST 12
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_NUM 64
> > +/* Unbinding secret token. The adapter validates this unbinding token by
> > + * comparing it against the one stored on the adapter as part of the
> > + * MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest. Refer to SF-115479-TC for
> > + * more information.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_UNBINDTOKEN_OFST 76
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_UNBINDTOKEN_LEN 16
> > +/* This is the signature of the above mentioned fields- TSANID, TSAID and
> > + * UNBINDTOKEN. As per current requirements, the SIG opaque data blob contains
> > + * ECDSA ECC-384 based signature. The ECC curve is secp384r1. The signature is
> > + * also ASN-1 encoded. Note- The signature is verified based on the public key
> > + * stored into the root certificate that is provisioned on the adapter side.
> > + * This key is known as the PUKtsaid. Refer to SF-115479-TC for more
> > + * information.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_OFST 92
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MINNUM 1
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MAXNUM 160
> > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MAXNUM_MCDI2 928
> > +
> > +/* MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest */
> > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_LEN 20
> > +/* The operation requested. */
> > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_OP_LEN 4
> > +/* Unbinding secret token. TSAN persists the unbinding secret token. Refer to
> > + * SF-115479-TC for more information.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_UNBINDTOKEN_OFST 4
> > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_UNBINDTOKEN_LEN 16
> > +/* enum: There are situations when the binding process does not complete
> > + * successfully due to key, other attributes corruption at the database level
> > + * (Controller). Adapter can't connect to the controller anymore. To recover,
> > + * make usage of the decommission command that forces the adapter into
> > + * unbinding state.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_ADAPTER_BINDING_FAILURE 0x1
> > +
> > +/* MC_CMD_TSA_BIND_IN_DECOMMISSION msgrequest: Obsolete. Use
> > + * MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMIN 109
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMAX 252
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMAX_MCDI2 1020
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LEN(num) (108+1*(num))
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_NUM(len) (((len)-108)/1)
> > +/* This is the signature of the above mentioned fields- TSAID, USER and REASON.
> > + * As per current requirements, the SIG opaque data blob contains ECDSA ECC-384
> > + * based signature. The ECC curve is secp384r1. The signature is also ASN-1
> > + * encoded . Note- The signature is verified based on the public key stored
> > + * into the root certificate that is provisioned on the adapter side. This key
> > + * is known as the PUKtsaid. Refer to SF-115479-TC for more information.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_OFST 108
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MINNUM 1
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MAXNUM 144
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MAXNUM_MCDI2 912
> > +/* The operation requested. */
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_OP_LEN 4
> > +/* This attribute identifies the TSA infrastructure domain. The length of the
> > + * TSAID attribute is limited to 64 bytes. This is how TSA SDK defines the max
> > + * length. Note- The TSAID is the Organizational Unit Name filed as part of the
> > + * root and server certificates.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_OFST 4
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_NUM 64
> > +/* User ID that comes, as an example, from the Controller. Note- The 33 byte
> > + * length of this attribute is max length of the linux user name plus null
> > + * character.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_OFST 68
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_NUM 33
> > +/* Align the arguments to 32 bits */
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_RSVD_OFST 101
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_RSVD_LEN 3
> > +/* Reason of why decommissioning happens Note- The list of reasons, defined as
> > + * part of the enumeration below, can be extended.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_REASON_OFST 104
> > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_REASON_LEN 4
> > +
> > +/* MC_CMD_TSA_BIND_IN_GET_CERTIFICATE msgrequest: Obsolete. Use
> > + * MC_CMD_GET_CERTIFICATE.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_LEN 8
> > +/* The operation requested, must be MC_CMD_TSA_BIND_OP_GET_CERTIFICATE. */
> > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_OP_LEN 4
> > +/* Type of the certificate to be retrieved. */
> > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_TYPE_OFST 4
> > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_TYPE_LEN 4
> > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_UNUSED 0x0 /* enum */
> > +/* enum: Adapter Authentication Certificate (AAC). The AAC is used by the
> > + * controller to verify the authenticity of the adapter.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_AAC 0x1
> > +/* enum: Adapter Authentication Signing Certificate (AASC). The AASC is used by
> > + * the controller to verify the validity of AAC.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_AASC 0x2
> > +
> > +/* MC_CMD_TSA_BIND_IN_SECURE_UNBIND msgrequest: Request a secure unbinding
> > + * operation using unbinding token.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMIN 97
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMAX 200
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMAX_MCDI2 200
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LEN(num) (96+1*(num))
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_NUM(len) (((len)-96)/1)
> > +/* The operation requested, must be MC_CMD_TSA_BIND_OP_SECURE_UNBIND. */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_OP_LEN 4
> > +/* Type of the message. (MESSAGE_TYPE_xxx) Must be
> > + * MESSAGE_TYPE_TSA_SECURE_UNBIND.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_MESSAGE_TYPE_OFST 4
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_MESSAGE_TYPE_LEN 4
> > +/* TSAN unique identifier for the network adapter */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_OFST 8
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_LEN 6
> > +/* Align the arguments to 32 bits */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_RSVD_OFST 14
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_RSVD_LEN 2
> > +/* A NUL padded US-ASCII string identifying the TSA infrastructure domain. This
> > + * field is for information only, and not used by the firmware. Note- The TSAID
> > + * is the Organizational Unit Name field as part of the root and server
> > + * certificates.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_OFST 16
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_NUM 64
> > +/* Unbinding secret token. The adapter validates this unbinding token by
> > + * comparing it against the one stored on the adapter as part of the
> > + * MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest. Refer to SF-115479-TC for
> > + * more information.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_UNBINDTOKEN_OFST 80
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_UNBINDTOKEN_LEN 16
> > +/* The signature computed and encoded as specified by MESSAGE_TYPE. */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_OFST 96
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MINNUM 1
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MAXNUM 104
> > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MAXNUM_MCDI2 104
> > +
> > +/* MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION msgrequest: Request a secure
> > + * decommissioning operation.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMIN 113
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMAX 216
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMAX_MCDI2 216
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LEN(num) (112+1*(num))
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_NUM(len) (((len)-112)/1)
> > +/* The operation requested, must be MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION. */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_OP_LEN 4
> > +/* Type of the message. (MESSAGE_TYPE_xxx) Must be
> > + * MESSAGE_TYPE_SECURE_DECOMMISSION.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_MESSAGE_TYPE_OFST 4
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_MESSAGE_TYPE_LEN 4
> > +/* A NUL padded US-ASCII string identifying the TSA infrastructure domain. This
> > + * field is for information only, and not used by the firmware. Note- The TSAID
> > + * is the Organizational Unit Name field as part of the root and server
> > + * certificates.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_OFST 8
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_NUM 64
> > +/* A NUL padded US-ASCII string containing user name of the creator of the
> > + * decommissioning ticket. This field is for information only, and not used by
> > + * the firmware.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_OFST 72
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_NUM 36
> > +/* Reason of why decommissioning happens */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_REASON_OFST 108
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_REASON_LEN 4
> > +/* enum: There are situations when the binding process does not complete
> > + * successfully due to key, other attributes corruption at the database level
> > + * (Controller). Adapter can't connect to the controller anymore. To recover,
> > + * use the decommission command to force the adapter into unbound state.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_ADAPTER_BINDING_FAILURE 0x1
> > +/* The signature computed and encoded as specified by MESSAGE_TYPE. */
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_OFST 112
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_LEN 1
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MINNUM 1
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MAXNUM 104
> > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MAXNUM_MCDI2 104
> > +
> > +/* MC_CMD_TSA_BIND_IN_TEST_MCDI msgrequest: Test mode that emulates MCDI
> > + * interface restrictions of a bound adapter. This operation is intended for
> > + * test use on adapters that are not deployed and bound to a TSA Controller.
> > + * Using it on a Bound adapter will succeed but will not alter the MCDI
> > + * privileges as MCDI operations will already be restricted.
> > + */
> > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_LEN 8
> > +/* The operation requested must be MC_CMD_TSA_BIND_OP_TEST_MCDI. */
> > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_OP_LEN 4
> > +/* Enable or disable emulation of bound adapter */
> > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_CTRL_OFST 4
> > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_CTRL_LEN 4
> > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_DISABLE 0x0 /* enum */
> > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_ENABLE 0x1 /* enum */
> > +
> > +/* MC_CMD_TSA_BIND_OUT_GET_ID msgresponse: Obsolete. Use
> > + * MC_CMD_SECURE_NIC_INFO_OUT_STATUS.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMIN 15
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMAX 252
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMAX_MCDI2 1020
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_LEN(num) (14+1*(num))
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_NUM(len) (((len)-14)/1)
> > +/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_ID that is sent back to
> > + * the caller.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_OP_LEN 4
> > +/* Rules engine type. Note- The rules engine type allows TSAC to further
> > + * identify the connected endpoint (e.g. TSAN, NIC Emulator) type and take the
> > + * proper action accordingly. As an example, TSAC uses the rules engine type to
> > + * select the SF key that differs in the case of TSAN vs. NIC Emulator.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_OFST 4
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_LEN 4
> > +/* enum: Hardware rules engine. */
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_TSAN 0x1
> > +/* enum: Nic emulator rules engine. */
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_NEMU 0x2
> > +/* enum: SSFE. */
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_SSFE 0x3
> > +/* TSAN unique identifier for the network adapter */
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_OFST 8
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_LEN 6
> > +/* The signature data blob. The signature is computed against the message
> > + * formed by TSAN ID concatenated with the NONCE value. Refer to SF-115479-TC
> > + * for more information also in respect to the private keys that are used to
> > + * sign the message based on TSAN pre/post-binding authentication procedure.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_OFST 14
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_LEN 1
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MINNUM 1
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM 238
> > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM_MCDI2 1006
> > +
> > +/* MC_CMD_TSA_BIND_OUT_GET_TICKET msgresponse */
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMIN 5
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMAX 252
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMAX_MCDI2 1020
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LEN(num) (4+1*(num))
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_NUM(len) (((len)-4)/1)
> > +/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_TICKET that is sent back
> > + * to the caller.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_OP_LEN 4
> > +/* The ticket represents the data blob construct that TSAN sends to TSAC as
> > + * part of the binding protocol. From the TSAN perspective the ticket is an
> > + * opaque construct. For more info refer to SF-115479-TC.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_OFST 4
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_LEN 1
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MINNUM 1
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MAXNUM 248
> > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MAXNUM_MCDI2 1016
> > +
> > +/* MC_CMD_TSA_BIND_OUT_SET_KEY msgresponse */
> > +#define MC_CMD_TSA_BIND_OUT_SET_KEY_LEN 4
> > +/* The protocol operation code MC_CMD_TSA_BIND_OP_SET_KEY that is sent back to
> > + * the caller.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_SET_KEY_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_SET_KEY_OP_LEN 4
> > +
> > +/* MC_CMD_TSA_BIND_OUT_UNBIND msgresponse: Response to insecure unbind request.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_LEN 8
> > +/* Same as MC_CMD_ERR field, but included as 0 in success cases */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_RESULT_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_RESULT_LEN 4
> > +/* Extra status information */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_INFO_OFST 4
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_INFO_LEN 4
> > +/* enum: Unbind successful. */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_OK_UNBOUND 0x0
> > +/* enum: TSANID mismatch */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_BAD_TSANID 0x1
> > +/* enum: Unable to remove the binding ticket from persistent storage. */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_REMOVE_TICKET 0x2
> > +/* enum: TSAN is not bound to a binding ticket. */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_NOT_BOUND 0x3
> > +
> > +/* MC_CMD_TSA_BIND_OUT_UNBIND_EXT msgresponse: Obsolete. Use
> > + * MC_CMD_TSA_BIND_OUT_SECURE_UNBIND.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_LEN 8
> > +/* Same as MC_CMD_ERR field, but included as 0 in success cases */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_RESULT_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_RESULT_LEN 4
> > +/* Extra status information */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_INFO_OFST 4
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_INFO_LEN 4
> > +/* enum: Unbind successful. */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_OK_UNBOUND 0x0
> > +/* enum: TSANID mismatch */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_TSANID 0x1
> > +/* enum: Unable to remove the binding ticket from persistent storage. */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_REMOVE_TICKET 0x2
> > +/* enum: TSAN is not bound to a binding ticket. */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_NOT_BOUND 0x3
> > +/* enum: Invalid unbind token */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_TOKEN 0x4
> > +/* enum: Invalid signature */
> > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_SIGNATURE 0x5
> > +
> > +/* MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN msgresponse */
> > +#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_LEN 4
> > +/* The protocol operation code MC_CMD_TSA_BIND_OP_SET_UNBINDTOKEN that is sent
> > + * back to the caller.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_OP_LEN 4
> > +
> > +/* MC_CMD_TSA_BIND_OUT_DECOMMISSION msgresponse: Obsolete. Use
> > + * MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_LEN 4
> > +/* The protocol operation code MC_CMD_TSA_BIND_OP_DECOMMISSION that is sent
> > + * back to the caller.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_OP_LEN 4
> > +
> > +/* MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE msgresponse */
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMIN 9
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMAX 252
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMAX_MCDI2 1020
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LEN(num) (8+1*(num))
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_NUM(len) (((len)-8)/1)
> > +/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_CERTIFICATE that is sent
> > + * back to the caller.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_OP_LEN 4
> > +/* Type of the certificate. */
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_TYPE_OFST 4
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_TYPE_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MC_CMD_TSA_BIND_IN_GET_CERTIFICATE/TYPE */
> > +/* The certificate data. */
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_OFST 8
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_LEN 1
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MINNUM 1
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MAXNUM 244
> > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MAXNUM_MCDI2 1012
> > +
> > +/* MC_CMD_TSA_BIND_OUT_SECURE_UNBIND msgresponse: Response to secure unbind
> > + * request.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_LEN 8
> > +/* The protocol operation code that is sent back to the caller. */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OP_LEN 4
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_RESULT_OFST 4
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_RESULT_LEN 4
> > +/* enum: Unbind successful. */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OK_UNBOUND 0x0
> > +/* enum: TSANID mismatch */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_TSANID 0x1
> > +/* enum: Unable to remove the binding ticket from persistent storage. */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_REMOVE_TICKET 0x2
> > +/* enum: TSAN is not bound to a domain. */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_NOT_BOUND 0x3
> > +/* enum: Invalid unbind token */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_TOKEN 0x4
> > +/* enum: Invalid signature */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_SIGNATURE 0x5
> > +
> > +/* MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION msgresponse: Response to secure
> > + * decommission request.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_LEN 8
> > +/* The protocol operation code that is sent back to the caller. */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OP_LEN 4
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_RESULT_OFST 4
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_RESULT_LEN 4
> > +/* enum: Unbind successful. */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OK_UNBOUND 0x0
> > +/* enum: TSANID mismatch */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_TSANID 0x1
> > +/* enum: Unable to remove the binding ticket from persistent storage. */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_REMOVE_TICKET 0x2
> > +/* enum: TSAN is not bound to a domain. */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_NOT_BOUND 0x3
> > +/* enum: Invalid unbind token */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_TOKEN 0x4
> > +/* enum: Invalid signature */
> > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_SIGNATURE 0x5
> > +
> > +/* MC_CMD_TSA_BIND_OUT_TEST_MCDI msgrequest */
> > +#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_LEN 4
> > +/* The protocol operation code MC_CMD_TSA_BIND_OP_TEST_MCDI that is sent back
> > + * to the caller.
> > + */
> > +#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_OP_OFST 0
> > +#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_OP_LEN 4
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE
> > + * Manage the persistent NVRAM cache of security rules created with
> > + * MC_CMD_SET_SECURITY_RULE. Note that the cache is not automatically updated
> > + * as rules are added or removed; the active ruleset must be explicitly
> > + * committed to the cache. The cache may also be explicitly invalidated,
> > + * without affecting the currently active ruleset. When the cache is valid, it
> > + * will be loaded at power on or MC reboot, instead of the default ruleset.
> > + * Rollback of the currently active ruleset to the cached version (when it is
> > + * valid) is also supported. (Medford-only; for use by SolarSecure apps, not
> > + * directly by drivers. See SF-114946-SW.) NOTE - The only sub-operation
> > + * allowed in an adapter bound to a TSA controller from the local host is
> > + * OP_GET_CACHED_VERSION. All other sub-operations are prohibited.
> > + */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE 0x11a
> > +#undef MC_CMD_0x11a_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x11a_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN msgrequest */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_LEN 4
> > +/* the operation to perform */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_OFST 0
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_LEN 4
> > +/* enum: reports the ruleset version that is cached in persistent storage but
> > + * performs no other action
> > + */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_GET_CACHED_VERSION 0x0
> > +/* enum: rolls back the active state to the cached version. (May fail with
> > + * ENOENT if there is no valid cached version.)
> > + */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_ROLLBACK 0x1
> > +/* enum: commits the active state to the persistent cache */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_COMMIT 0x2
> > +/* enum: invalidates the persistent cache without affecting the active state */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_INVALIDATE 0x3
> > +
> > +/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT msgresponse */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMIN 5
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMAX 252
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMAX_MCDI2 1020
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LEN(num) (4+1*(num))
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_NUM(len) (((len)-4)/1)
> > +/* indicates whether the persistent cache is valid (after completion of the
> > + * requested operation in the case of rollback, commit, or invalidate)
> > + */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_OFST 0
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_LEN 4
> > +/* enum: persistent cache is invalid (the VERSION field will be empty in this
> > + * case)
> > + */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_INVALID 0x0
> > +/* enum: persistent cache is valid */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_VALID 0x1
> > +/* cached ruleset version (after completion of the requested operation, in the
> > + * case of rollback, commit, or invalidate) as an opaque hash value in the same
> > + * form as MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION
> > + */
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_OFST 4
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_LEN 1
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MINNUM 1
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MAXNUM 248
> > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MAXNUM_MCDI2 1016
> > +
> > +
> > /***********************************/
> > /* MC_CMD_NVRAM_PRIVATE_APPEND
> > * Append a single TLV to the MC_USAGE_TLV partition. Returns MC_CMD_ERR_EEXIST
> > @@ -23087,7 +25047,7 @@
> > #define MC_CMD_NVRAM_PRIVATE_APPEND 0x11c
> > #undef MC_CMD_0x11c_PRIVILEGE_CTG
> >
> > -#define MC_CMD_0x11c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +#define MC_CMD_0x11c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> >
> > /* MC_CMD_NVRAM_PRIVATE_APPEND_IN msgrequest */
> > #define MC_CMD_NVRAM_PRIVATE_APPEND_IN_LENMIN 9
> > @@ -23409,6 +25369,38 @@
> > #define MC_CMD_DEALLOCATE_TX_VFIFO_CP_OUT_LEN 0
> >
> >
> > +/***********************************/
> > +/* MC_CMD_REKEY
> > + * This request causes the NIC to generate a new per-NIC key and program it
> > + * into the write-once memory. During the process all flash partitions that are
> > + * protected with a CMAC are verified with the old per-NIC key and then signed
> > + * with the new per-NIC key. If the NIC has already reached its rekey limit the
> > + * REKEY op will return MC_CMD_ERR_ERANGE. The REKEY op may block until
> > + * completion or it may return 0 and continue processing, therefore the caller
> > + * must poll at least once to confirm that the rekeying has completed. The POLL
> > + * operation returns MC_CMD_ERR_EBUSY if the rekey process is still running
> > + * otherwise it will return the result of the last completed rekey operation,
> > + * or 0 if there has not been a previous rekey.
> > + */
> > +#define MC_CMD_REKEY 0x123
> > +#undef MC_CMD_0x123_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x123_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_REKEY_IN msgrequest */
> > +#define MC_CMD_REKEY_IN_LEN 4
> > +/* the type of operation requested */
> > +#define MC_CMD_REKEY_IN_OP_OFST 0
> > +#define MC_CMD_REKEY_IN_OP_LEN 4
> > +/* enum: Start the rekeying operation */
> > +#define MC_CMD_REKEY_IN_OP_REKEY 0x0
> > +/* enum: Poll for completion of the rekeying operation */
> > +#define MC_CMD_REKEY_IN_OP_POLL 0x1
> > +
> > +/* MC_CMD_REKEY_OUT msgresponse */
> > +#define MC_CMD_REKEY_OUT_LEN 0
> > +
> > +
> > /***********************************/
> > /* MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS
> > * This interface allows the host to find out how many common pool buffers are
> > @@ -23432,6 +25424,945 @@
> > #define MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS_OUT_ENG_LEN 4
> >
> >
> > +/***********************************/
> > +/* MC_CMD_SET_SECURITY_FUSES
> > + * Change the security level of the adapter by setting bits in the write-once
> > + * memory. The firmware maps each flag in the message to a set of one or more
> > + * hardware-defined or software-defined bits and sets these bits in the write-
> > + * once memory. For Medford the hardware-defined bits are defined in
> > + * SF-112079-PS 5.3, the software-defined bits are defined in xpm.h. Returns 0
> > + * if all of the required bits were set and returns MC_CMD_ERR_EIO if any of
> > + * the required bits were not set.
> > + */
> > +#define MC_CMD_SET_SECURITY_FUSES 0x126
> > +#undef MC_CMD_0x126_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x126_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_SET_SECURITY_FUSES_IN msgrequest */
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_LEN 4
> > +/* Flags specifying what type of security features are being set */
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_FLAGS_OFST 0
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_FLAGS_LEN 4
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_OFST 0
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_LBN 0
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_OFST 0
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_LBN 1
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_WIDTH 1
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_OFST 0
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_LBN 31
> > +#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_WIDTH 1
> > +
> > +/* MC_CMD_SET_SECURITY_FUSES_OUT msgresponse */
> > +#define MC_CMD_SET_SECURITY_FUSES_OUT_LEN 0
> > +
> > +/* MC_CMD_SET_SECURITY_FUSES_V2_OUT msgresponse */
> > +#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_LEN 4
> > +/* Flags specifying which security features are enforced on the NIC after the
> > + * flags in the request have been applied. See
> > + * MC_CMD_SET_SECURITY_FUSES_IN/FLAGS for flag definitions.
> > + */
> > +#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_FLAGS_OFST 0
> > +#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_FLAGS_LEN 4
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_TSA_INFO
> > + * Messages sent from TSA adapter to TSA controller. This command is only valid
> > + * when the MCDI header has MESSAGE_TYPE set to MCDI_MESSAGE_TYPE_TSA. This
> > + * command is not sent by the driver to the MC; it is sent from the MC to a TSA
> > + * controller, being treated more like an alert message rather than a command;
> > + * hence the MC does not expect a response in return. Doxbox reference
> > + * SF-117371-SW
> > + */
> > +#define MC_CMD_TSA_INFO 0x127
> > +#undef MC_CMD_0x127_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x127_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_TSA_INFO_IN msgrequest */
> > +#define MC_CMD_TSA_INFO_IN_LEN 4
> > +#define MC_CMD_TSA_INFO_IN_OP_HDR_OFST 0
> > +#define MC_CMD_TSA_INFO_IN_OP_HDR_LEN 4
> > +#define MC_CMD_TSA_INFO_IN_OP_OFST 0
> > +#define MC_CMD_TSA_INFO_IN_OP_LBN 0
> > +#define MC_CMD_TSA_INFO_IN_OP_WIDTH 16
> > +/* enum: Information about recently discovered local IP address of the adapter
> > + */
> > +#define MC_CMD_TSA_INFO_OP_LOCAL_IP 0x1
> > +/* enum: Information about a sampled packet that either - did not match any
> > + * black/white-list filters and was allowed by the default filter or - did not
> > + * match any black/white-list filters and was denied by the default filter
> > + */
> > +#define MC_CMD_TSA_INFO_OP_PKT_SAMPLE 0x2
> > +/* enum: Information about an unbind or decommission attempt. */
> > +#define MC_CMD_TSA_INFO_OP_UNBIND 0x3
> > +
> > +/* MC_CMD_TSA_INFO_IN_LOCAL_IP msgrequest:
> > + *
> > + * The TSA controller maintains a list of IP addresses valid for each port of a
> > + * TSA adapter. The TSA controller requires information from the adapter
> > + * inorder to learn new IP addresses assigned to a physical port and to
> > + * identify those that are no longer assigned to the physical port. For this
> > + * purpose, the TSA adapter snoops ARP replys, gratuitous ARP requests and ARP
> > + * probe packets seen on each physical port. This definition describes the
> > + * format of the notification message sent from a TSA adapter to a TSA
> > + * controller related to any information related to a change in IP address
> > + * assignment for a port. Doxbox reference SF-117371.
> > + *
> > + * There may be a possibility of combining multiple notifications in a single
> > + * message in future. When that happens, a new flag can be defined using the
> > + * reserved bits to describe the extended format of this notification.
> > + */
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_LEN 18
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_OP_HDR_OFST 0
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_OP_HDR_LEN 4
> > +/* Additional metadata describing the IP address information such as source of
> > + * information retrieval, type of IP address, physical port number.
> > + */
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_LEN 4
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_LBN 0
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_WIDTH 8
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_LBN 8
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_WIDTH 8
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_LBN 16
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_WIDTH 8
> > +/* enum: ARP reply sent out of the physical port */
> > +#define MC_CMD_TSA_INFO_IP_REASON_TX_ARP 0x0
> > +/* enum: ARP probe packet received on the physical port */
> > +#define MC_CMD_TSA_INFO_IP_REASON_RX_ARP_PROBE 0x1
> > +/* enum: Gratuitous ARP packet received on the physical port */
> > +#define MC_CMD_TSA_INFO_IP_REASON_RX_GRATUITOUS_ARP 0x2
> > +/* enum: DHCP ACK packet received on the physical port */
> > +#define MC_CMD_TSA_INFO_IP_REASON_RX_DHCP_ACK 0x3
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_LBN 24
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_WIDTH 1
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_LBN 25
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_WIDTH 7
> > +/* IPV4 address retrieved from the sampled packets. This field is relevant only
> > + * when META_IPV4 is set to 1.
> > + */
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_IPV4_ADDR_OFST 8
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_IPV4_ADDR_LEN 4
> > +/* Target MAC address retrieved from the sampled packet. */
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_OFST 12
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_LEN 1
> > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_NUM 6
> > +
> > +/* MC_CMD_TSA_INFO_IN_PKT_SAMPLE msgrequest:
> > + *
> > + * It is desireable for the TSA controller to learn the traffic pattern of
> > + * packets seen at the network port being monitored. In order to learn about
> > + * the traffic pattern, the TSA controller may want to sample packets seen at
> > + * the network port. Based on the packet samples that the TSA controller
> > + * receives from the adapter, the controller may choose to configure additional
> > + * black-list or white-list rules to allow or block packets as required.
> > + *
> > + * Although the entire sampled packet as seen on the network port is available
> > + * to the MC the length of sampled packet sent to controller is restricted by
> > + * MCDI payload size. Besides, the TSA controller does not require the entire
> > + * packet to make decisions about filter updates. Hence the packet sample being
> > + * passed to the controller is truncated to 128 bytes. This length is large
> > + * enough to hold the ethernet header, IP header and maximum length of
> > + * supported L4 protocol headers (IPv4 only, but can hold IPv6 header too, if
> > + * required in future).
> > + *
> > + * The intention is that any future changes to this message format that are not
> > + * backwards compatible will be defined with a new operation code.
> > + */
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_LEN 136
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_OP_HDR_OFST 0
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_OP_HDR_LEN 4
> > +/* Additional metadata describing the sampled packet */
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_LEN 4
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_LBN 0
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_WIDTH 8
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_LBN 8
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_WIDTH 1
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_LBN 9
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_WIDTH 7
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_LBN 16
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_WIDTH 4
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_LBN 16
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_WIDTH 1
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_LBN 17
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_WIDTH 1
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_LBN 18
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_WIDTH 1
> > +/* 128-byte raw prefix of the sampled packet which includes the ethernet
> > + * header, IP header and L4 protocol header (only IPv4 supported initially).
> > + * This provides the controller enough information about the packet sample to
> > + * report traffic patterns seen on a network port and to make decisions
> > + * concerning rule-set updates.
> > + */
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_OFST 8
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_LEN 1
> > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_NUM 128
> > +
> > +/* MC_CMD_TSA_INFO_IN_UNBIND msgrequest: Information about an unbind or
> > + * decommission attempt. The purpose of this event is to let the controller
> > + * know about unbind and decommission attempts (both successful and failed)
> > + * received from the adapter host. The event is not sent if the unbind or
> > + * decommission request was received from the controller.
> > + */
> > +#define MC_CMD_TSA_INFO_IN_UNBIND_LEN 12
> > +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_HDR_OFST 0
> > +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_HDR_LEN 4
> > +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_OFST 0
> > +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_LBN 0
> > +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_WIDTH 16
> > +/* Type of the unbind attempt. */
> > +#define MC_CMD_TSA_INFO_IN_UNBIND_TYPE_OFST 4
> > +#define MC_CMD_TSA_INFO_IN_UNBIND_TYPE_LEN 4
> > +/* enum: This event is sent because MC_CMD_TSA_BIND_OP_SECURE_UNBIND was
> > + * received from the adapter local host.
> > + */
> > +#define MC_CMD_TSA_INFO_UNBIND_TYPE_SECURE_UNBIND 0x1
> > +/* enum: This event is sent because MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION was
> > + * received from the adapter local host.
> > + */
> > +#define MC_CMD_TSA_INFO_UNBIND_TYPE_SECURE_DECOMMISSION 0x2
> > +/* Result of the attempt. */
> > +#define MC_CMD_TSA_INFO_IN_UNBIND_RESULT_OFST 8
> > +#define MC_CMD_TSA_INFO_IN_UNBIND_RESULT_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MC_CMD_TSA_BIND/MC_CMD_TSA_BIND_OUT_SECURE_UNBIND/RESULT */
> > +
> > +/* MC_CMD_TSA_INFO_OUT msgresponse */
> > +#define MC_CMD_TSA_INFO_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_HOST_INFO
> > + * Commands to appply or retrieve host-related information from an adapter.
> > + * Doxbox reference SF-117371-SW
> > + */
> > +#define MC_CMD_HOST_INFO 0x128
> > +#undef MC_CMD_0x128_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x128_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_HOST_INFO_IN msgrequest */
> > +#define MC_CMD_HOST_INFO_IN_LEN 4
> > +/* sub-operation code info */
> > +#define MC_CMD_HOST_INFO_IN_OP_HDR_OFST 0
> > +#define MC_CMD_HOST_INFO_IN_OP_HDR_LEN 4
> > +#define MC_CMD_HOST_INFO_IN_OP_OFST 0
> > +#define MC_CMD_HOST_INFO_IN_OP_LBN 0
> > +#define MC_CMD_HOST_INFO_IN_OP_WIDTH 16
> > +/* enum: Read a 16-byte unique host identifier from the adapter. This UUID
> > + * helps to identify the host that an adapter is plugged into. This identifier
> > + * is ideally the system UUID retrieved and set by the UEFI driver. If the UEFI
> > + * driver is unable to extract the system UUID, it would still set a random
> > + * 16-byte value into each supported SF adapter plugged into it. Host UUIDs may
> > + * change if the system is power-cycled, however, they persist across adapter
> > + * resets. If the host UUID was not set on an adapter, due to an unsupported
> > + * version of UEFI driver, then this command returns an error. Doxbox reference
> > + * - SF-117371-SW section 'Host UUID'.
> > + */
> > +#define MC_CMD_HOST_INFO_OP_GET_UUID 0x0
> > +/* enum: Set a 16-byte unique host identifier on the adapter to identify the
> > + * host that the adapter is plugged into. See MC_CMD_HOST_INFO_OP_GET_UUID for
> > + * further details.
> > + */
> > +#define MC_CMD_HOST_INFO_OP_SET_UUID 0x1
> > +
> > +/* MC_CMD_HOST_INFO_IN_GET_UUID msgrequest */
> > +#define MC_CMD_HOST_INFO_IN_GET_UUID_LEN 4
> > +/* sub-operation code info */
> > +#define MC_CMD_HOST_INFO_IN_GET_UUID_OP_HDR_OFST 0
> > +#define MC_CMD_HOST_INFO_IN_GET_UUID_OP_HDR_LEN 4
> > +
> > +/* MC_CMD_HOST_INFO_OUT_GET_UUID msgresponse */
> > +#define MC_CMD_HOST_INFO_OUT_GET_UUID_LEN 16
> > +/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
> > + * for further details.
> > + */
> > +#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_OFST 0
> > +#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_LEN 1
> > +#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_NUM 16
> > +
> > +/* MC_CMD_HOST_INFO_IN_SET_UUID msgrequest */
> > +#define MC_CMD_HOST_INFO_IN_SET_UUID_LEN 20
> > +/* sub-operation code info */
> > +#define MC_CMD_HOST_INFO_IN_SET_UUID_OP_HDR_OFST 0
> > +#define MC_CMD_HOST_INFO_IN_SET_UUID_OP_HDR_LEN 4
> > +/* 16-byte host UUID set on the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID for
> > + * further details.
> > + */
> > +#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_OFST 4
> > +#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_LEN 1
> > +#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_NUM 16
> > +
> > +/* MC_CMD_HOST_INFO_OUT_SET_UUID msgresponse */
> > +#define MC_CMD_HOST_INFO_OUT_SET_UUID_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_TSAN_INFO
> > + * Get TSA adapter information. TSA controllers query each TSA adapter to learn
> > + * some configuration parameters of each adapter. Doxbox reference SF-117371-SW
> > + * section 'Adapter Information'
> > + */
> > +#define MC_CMD_TSAN_INFO 0x129
> > +#undef MC_CMD_0x129_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x129_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_TSAN_INFO_IN msgrequest */
> > +#define MC_CMD_TSAN_INFO_IN_LEN 4
> > +/* sub-operation code info */
> > +#define MC_CMD_TSAN_INFO_IN_OP_HDR_OFST 0
> > +#define MC_CMD_TSAN_INFO_IN_OP_HDR_LEN 4
> > +#define MC_CMD_TSAN_INFO_IN_OP_OFST 0
> > +#define MC_CMD_TSAN_INFO_IN_OP_LBN 0
> > +#define MC_CMD_TSAN_INFO_IN_OP_WIDTH 16
> > +/* enum: Read configuration parameters and IDs that uniquely identify an
> > + * adapter. The parameters include - host identification, adapter
> > + * identification string and number of physical ports on the adapter.
> > + */
> > +#define MC_CMD_TSAN_INFO_OP_GET_CFG 0x0
> > +
> > +/* MC_CMD_TSAN_INFO_IN_GET_CFG msgrequest */
> > +#define MC_CMD_TSAN_INFO_IN_GET_CFG_LEN 4
> > +/* sub-operation code info */
> > +#define MC_CMD_TSAN_INFO_IN_GET_CFG_OP_HDR_OFST 0
> > +#define MC_CMD_TSAN_INFO_IN_GET_CFG_OP_HDR_LEN 4
> > +
> > +/* MC_CMD_TSAN_INFO_OUT_GET_CFG msgresponse */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_LEN 26
> > +/* Information about the configuration parameters returned in this response. */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CONFIG_WORD_OFST 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CONFIG_WORD_LEN 4
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_OFST 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_LBN 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_WIDTH 16
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_OFST 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_LBN 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_WIDTH 1
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_OFST 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_LBN 16
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_WIDTH 8
> > +/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
> > + * for further details.
> > + */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_OFST 4
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_LEN 1
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_NUM 16
> > +/* A unique identifier per adapter. The base MAC address of the card is used
> > + * for this purpose.
> > + */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_OFST 20
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_LEN 1
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_NUM 6
> > +
> > +/* MC_CMD_TSAN_INFO_OUT_GET_CFG_V2 msgresponse */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_LEN 36
> > +/* Information about the configuration parameters returned in this response. */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CONFIG_WORD_OFST 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CONFIG_WORD_LEN 4
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_OFST 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_LBN 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_WIDTH 16
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_OFST 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_LBN 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_WIDTH 1
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_OFST 0
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_LBN 16
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_WIDTH 8
> > +/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
> > + * for further details.
> > + */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_OFST 4
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_LEN 1
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_NUM 16
> > +/* A unique identifier per adapter. The base MAC address of the card is used
> > + * for this purpose.
> > + */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_OFST 20
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_LEN 1
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_NUM 6
> > +/* Unused bytes, defined for 32-bit alignment of new fields. */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_UNUSED_OFST 26
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_UNUSED_LEN 2
> > +/* Maximum number of TSA statistics counters in each direction of dataflow
> > + * supported on the card. Note that the statistics counters are always
> > + * allocated in pairs, i.e. a counter ID is associated with one Tx and one Rx
> > + * counter.
> > + */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_MAX_STATS_OFST 28
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_MAX_STATS_LEN 4
> > +/* Width of each statistics counter (represented in bits). This gives an
> > + * indication of wrap point to the user.
> > + */
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_STATS_WIDTH_OFST 32
> > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_STATS_WIDTH_LEN 4
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_TSA_STATISTICS
> > + * TSA adapter statistics operations.
> > + */
> > +#define MC_CMD_TSA_STATISTICS 0x130
> > +#undef MC_CMD_0x130_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x130_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_TSA_STATISTICS_IN msgrequest */
> > +#define MC_CMD_TSA_STATISTICS_IN_LEN 4
> > +/* TSA statistics sub-operation code */
> > +#define MC_CMD_TSA_STATISTICS_IN_OP_CODE_OFST 0
> > +#define MC_CMD_TSA_STATISTICS_IN_OP_CODE_LEN 4
> > +/* enum: Get the configuration parameters that describe the TSA statistics
> > + * layout on the adapter.
> > + */
> > +#define MC_CMD_TSA_STATISTICS_OP_GET_CONFIG 0x0
> > +/* enum: Read and/or clear TSA statistics counters. */
> > +#define MC_CMD_TSA_STATISTICS_OP_READ_CLEAR 0x1
> > +
> > +/* MC_CMD_TSA_STATISTICS_IN_GET_CONFIG msgrequest */
> > +#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_LEN 4
> > +/* TSA statistics sub-operation code */
> > +#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_OP_CODE_OFST 0
> > +#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_OP_CODE_LEN 4
> > +
> > +/* MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG msgresponse */
> > +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_LEN 8
> > +/* Maximum number of TSA statistics counters in each direction of dataflow
> > + * supported on the card. Note that the statistics counters are always
> > + * allocated in pairs, i.e. a counter ID is associated with one Tx and one Rx
> > + * counter.
> > + */
> > +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_MAX_STATS_OFST 0
> > +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_MAX_STATS_LEN 4
> > +/* Width of each statistics counter (represented in bits). This gives an
> > + * indication of wrap point to the user.
> > + */
> > +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_STATS_WIDTH_OFST 4
> > +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_STATS_WIDTH_LEN 4
> > +
> > +/* MC_CMD_TSA_STATISTICS_IN_READ_CLEAR msgrequest */
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMIN 20
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMAX 252
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMAX_MCDI2 1020
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LEN(num) (16+4*(num))
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_NUM(len) (((len)-16)/4)
> > +/* TSA statistics sub-operation code */
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_OP_CODE_OFST 0
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_OP_CODE_LEN 4
> > +/* Parameters describing the statistics operation */
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_FLAGS_OFST 4
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_FLAGS_LEN 4
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_OFST 4
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_LBN 0
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_WIDTH 1
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_OFST 4
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_LBN 1
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_WIDTH 1
> > +/* Counter ID list specification type */
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_MODE_OFST 8
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_MODE_LEN 4
> > +/* enum: The statistics counters are specified as an unordered list of
> > + * individual counter ID.
> > + */
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LIST 0x0
> > +/* enum: The statistics counters are specified as a range of consecutive
> > + * counter IDs.
> > + */
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_RANGE 0x1
> > +/* Number of statistics counters */
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_NUM_STATS_OFST 12
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_NUM_STATS_LEN 4
> > +/* Counter IDs to be read/cleared. When mode is set to LIST, this entry holds a
> > + * list of counter IDs to be operated on. When mode is set to RANGE, this entry
> > + * holds a single counter ID representing the start of the range of counter IDs
> > + * to be operated on.
> > + */
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_OFST 16
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_LEN 4
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MINNUM 1
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MAXNUM 59
> > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MAXNUM_MCDI2 251
> > +
> > +/* MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR msgresponse */
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMIN 24
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMAX 248
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMAX_MCDI2 1016
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LEN(num) (8+16*(num))
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_NUM(len) (((len)-8)/16)
> > +/* Number of statistics counters returned in this response */
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_NUM_STATS_OFST 0
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_NUM_STATS_LEN 4
> > +/* MC_TSA_STATISTICS_ENTRY Note that this field is expected to start at a
> > + * 64-bit aligned offset
> > + */
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_OFST 8
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_LEN 16
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MINNUM 1
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MAXNUM 15
> > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MAXNUM_MCDI2 63
> > +
> > +/* MC_TSA_STATISTICS_ENTRY structuredef */
> > +#define MC_TSA_STATISTICS_ENTRY_LEN 16
> > +/* Tx statistics counter */
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_OFST 0
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LEN 8
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_OFST 0
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_LEN 4
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_LBN 0
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_WIDTH 32
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_OFST 4
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_LEN 4
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_LBN 32
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_WIDTH 32
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LBN 0
> > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_WIDTH 64
> > +/* Rx statistics counter */
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_OFST 8
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LEN 8
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_OFST 8
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_LEN 4
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_LBN 64
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_WIDTH 32
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_OFST 12
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_LEN 4
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_LBN 96
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_WIDTH 32
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LBN 64
> > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_WIDTH 64
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_ERASE_INITIAL_NIC_SECRET
> > + * This request causes the NIC to find the initial NIC secret (programmed
> > + * during ATE) in XPM memory and if and only if the NIC has already been
> > + * rekeyed with MC_CMD_REKEY, erase it. This is used by manftest after
> > + * installing TSA binding certificates. See SF-117631-TC.
> > + */
> > +#define MC_CMD_ERASE_INITIAL_NIC_SECRET 0x131
> > +#undef MC_CMD_0x131_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x131_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_ERASE_INITIAL_NIC_SECRET_IN msgrequest */
> > +#define MC_CMD_ERASE_INITIAL_NIC_SECRET_IN_LEN 0
> > +
> > +/* MC_CMD_ERASE_INITIAL_NIC_SECRET_OUT msgresponse */
> > +#define MC_CMD_ERASE_INITIAL_NIC_SECRET_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_TSA_CONFIG
> > + * TSA adapter configuration operations. This command is used to prepare the
> > + * NIC for TSA binding.
> > + */
> > +#define MC_CMD_TSA_CONFIG 0x64
> > +#undef MC_CMD_0x64_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x64_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_TSA_CONFIG_IN msgrequest */
> > +#define MC_CMD_TSA_CONFIG_IN_LEN 4
> > +/* TSA configuration sub-operation code */
> > +#define MC_CMD_TSA_CONFIG_IN_OP_OFST 0
> > +#define MC_CMD_TSA_CONFIG_IN_OP_LEN 4
> > +/* enum: Append a single item to the tsa_config partition. Items will be
> > + * encrypted unless they are declared as non-sensitive. Returns
> > + * MC_CMD_ERR_EEXIST if the tag is already present.
> > + */
> > +#define MC_CMD_TSA_CONFIG_OP_APPEND 0x1
> > +/* enum: Reset the tsa_config partition to a clean state. */
> > +#define MC_CMD_TSA_CONFIG_OP_RESET 0x2
> > +/* enum: Read back a configured item from tsa_config partition. Returns
> > + * MC_CMD_ERR_ENOENT if the item doesn't exist, or MC_CMD_ERR_EPERM if the item
> > + * is declared as sensitive (i.e. is encrypted).
> > + */
> > +#define MC_CMD_TSA_CONFIG_OP_READ 0x3
> > +
> > +/* MC_CMD_TSA_CONFIG_IN_APPEND msgrequest */
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMIN 12
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMAX 252
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMAX_MCDI2 1020
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LEN(num) (12+1*(num))
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_NUM(len) (((len)-12)/1)
> > +/* TSA configuration sub-operation code. The value shall be
> > + * MC_CMD_TSA_CONFIG_OP_APPEND.
> > + */
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_OP_OFST 0
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_OP_LEN 4
> > +/* The tag to be appended */
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_TAG_OFST 4
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_TAG_LEN 4
> > +/* The length of the data in bytes */
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENGTH_OFST 8
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENGTH_LEN 4
> > +/* The item data */
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_OFST 12
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_LEN 1
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MINNUM 0
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MAXNUM 240
> > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MAXNUM_MCDI2 1008
> > +
> > +/* MC_CMD_TSA_CONFIG_OUT_APPEND msgresponse */
> > +#define MC_CMD_TSA_CONFIG_OUT_APPEND_LEN 0
> > +
> > +/* MC_CMD_TSA_CONFIG_IN_RESET msgrequest */
> > +#define MC_CMD_TSA_CONFIG_IN_RESET_LEN 4
> > +/* TSA configuration sub-operation code. The value shall be
> > + * MC_CMD_TSA_CONFIG_OP_RESET.
> > + */
> > +#define MC_CMD_TSA_CONFIG_IN_RESET_OP_OFST 0
> > +#define MC_CMD_TSA_CONFIG_IN_RESET_OP_LEN 4
> > +
> > +/* MC_CMD_TSA_CONFIG_OUT_RESET msgresponse */
> > +#define MC_CMD_TSA_CONFIG_OUT_RESET_LEN 0
> > +
> > +/* MC_CMD_TSA_CONFIG_IN_READ msgrequest */
> > +#define MC_CMD_TSA_CONFIG_IN_READ_LEN 8
> > +/* TSA configuration sub-operation code. The value shall be
> > + * MC_CMD_TSA_CONFIG_OP_READ.
> > + */
> > +#define MC_CMD_TSA_CONFIG_IN_READ_OP_OFST 0
> > +#define MC_CMD_TSA_CONFIG_IN_READ_OP_LEN 4
> > +/* The tag to be read */
> > +#define MC_CMD_TSA_CONFIG_IN_READ_TAG_OFST 4
> > +#define MC_CMD_TSA_CONFIG_IN_READ_TAG_LEN 4
> > +
> > +/* MC_CMD_TSA_CONFIG_OUT_READ msgresponse */
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_LENMIN 8
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_LENMAX 252
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_LENMAX_MCDI2 1020
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_LEN(num) (8+1*(num))
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_NUM(len) (((len)-8)/1)
> > +/* The tag that was read */
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_TAG_OFST 0
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_TAG_LEN 4
> > +/* The length of the data in bytes */
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_LENGTH_OFST 4
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_LENGTH_LEN 4
> > +/* The data of the item. */
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_OFST 8
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_LEN 1
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MINNUM 0
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MAXNUM 244
> > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MAXNUM_MCDI2 1012
> > +
> > +/* MC_TSA_IPV4_ITEM structuredef */
> > +#define MC_TSA_IPV4_ITEM_LEN 8
> > +/* Additional metadata describing the IP address information such as the
> > + * physical port number the address is being used on. Unused space in this
> > + * field is reserved for future expansion.
> > + */
> > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_OFST 0
> > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_LEN 4
> > +#define MC_TSA_IPV4_ITEM_PORT_IDX_OFST 0
> > +#define MC_TSA_IPV4_ITEM_PORT_IDX_LBN 0
> > +#define MC_TSA_IPV4_ITEM_PORT_IDX_WIDTH 8
> > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_LBN 0
> > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_WIDTH 32
> > +/* The IPv4 address in little endian byte order. */
> > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_OFST 4
> > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_LEN 4
> > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_LBN 32
> > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_WIDTH 32
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_TSA_IPADDR
> > + * TSA operations relating to the monitoring and expiry of local IP addresses
> > + * discovered by the controller. These commands are sent from a TSA controller
> > + * to a TSA adapter.
> > + */
> > +#define MC_CMD_TSA_IPADDR 0x65
> > +#undef MC_CMD_0x65_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x65_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_TSA_IPADDR_IN msgrequest */
> > +#define MC_CMD_TSA_IPADDR_IN_LEN 4
> > +/* Header containing information to identify which sub-operation of this
> > + * command to perform. The header contains a 16-bit op-code. Unused space in
> > + * this field is reserved for future expansion.
> > + */
> > +#define MC_CMD_TSA_IPADDR_IN_OP_HDR_OFST 0
> > +#define MC_CMD_TSA_IPADDR_IN_OP_HDR_LEN 4
> > +#define MC_CMD_TSA_IPADDR_IN_OP_OFST 0
> > +#define MC_CMD_TSA_IPADDR_IN_OP_LBN 0
> > +#define MC_CMD_TSA_IPADDR_IN_OP_WIDTH 16
> > +/* enum: Request that the adapter verifies that the IPv4 addresses supplied are
> > + * still in use by the host by sending ARP probes to the host. The MC does not
> > + * wait for a response to the probes and sends an MCDI response to the
> > + * controller once the probes have been sent to the host. The response to the
> > + * probes (if there are any) will be forwarded to the controller using
> > + * MC_CMD_TSA_INFO alerts.
> > + */
> > +#define MC_CMD_TSA_IPADDR_OP_VALIDATE_IPV4 0x1
> > +/* enum: Notify the adapter that one or more IPv4 addresses are no longer valid
> > + * for the host of the adapter. The adapter should remove the IPv4 addresses
> > + * from its local cache.
> > + */
> > +#define MC_CMD_TSA_IPADDR_OP_REMOVE_IPV4 0x2
> > +
> > +/* MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4 msgrequest */
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMIN 16
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMAX 248
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMAX_MCDI2 1016
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LEN(num) (8+8*(num))
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_NUM(len) (((len)-8)/8)
> > +/* Header containing information to identify which sub-operation of this
> > + * command to perform. The header contains a 16-bit op-code. Unused space in
> > + * this field is reserved for future expansion.
> > + */
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_HDR_OFST 0
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_HDR_LEN 4
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_OFST 0
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_LBN 0
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_WIDTH 16
> > +/* Number of IPv4 addresses to validate. */
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_NUM_ITEMS_OFST 4
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_NUM_ITEMS_LEN 4
> > +/* The IPv4 addresses to validate, in struct MC_TSA_IPV4_ITEM format. */
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_OFST 8
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LEN 8
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_OFST 8
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_LEN 4
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_LBN 64
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_WIDTH 32
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_OFST 12
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_LEN 4
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_LBN 96
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_WIDTH 32
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MINNUM 1
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MAXNUM 30
> > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MAXNUM_MCDI2 126
> > +
> > +/* MC_CMD_TSA_IPADDR_OUT_VALIDATE_IPV4 msgresponse */
> > +#define MC_CMD_TSA_IPADDR_OUT_VALIDATE_IPV4_LEN 0
> > +
> > +/* MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4 msgrequest */
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMIN 16
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMAX 248
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMAX_MCDI2 1016
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LEN(num) (8+8*(num))
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_NUM(len) (((len)-8)/8)
> > +/* Header containing information to identify which sub-operation of this
> > + * command to perform. The header contains a 16-bit op-code. Unused space in
> > + * this field is reserved for future expansion.
> > + */
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_HDR_OFST 0
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_HDR_LEN 4
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_OFST 0
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_LBN 0
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_WIDTH 16
> > +/* Number of IPv4 addresses to remove. */
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_NUM_ITEMS_OFST 4
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_NUM_ITEMS_LEN 4
> > +/* The IPv4 addresses that have expired, in struct MC_TSA_IPV4_ITEM format. */
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_OFST 8
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LEN 8
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_OFST 8
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_LEN 4
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_LBN 64
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_WIDTH 32
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_OFST 12
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_LEN 4
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_LBN 96
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_WIDTH 32
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MINNUM 1
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MAXNUM 30
> > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MAXNUM_MCDI2 126
> > +
> > +/* MC_CMD_TSA_IPADDR_OUT_REMOVE_IPV4 msgresponse */
> > +#define MC_CMD_TSA_IPADDR_OUT_REMOVE_IPV4_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_SECURE_NIC_INFO
> > + * Get secure NIC information. While many of the features reported by these
> > + * commands are related to TSA, they must be supported in firmware where TSA is
> > + * disabled.
> > + */
> > +#define MC_CMD_SECURE_NIC_INFO 0x132
> > +#undef MC_CMD_0x132_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x132_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > +
> > +/* MC_CMD_SECURE_NIC_INFO_IN msgrequest */
> > +#define MC_CMD_SECURE_NIC_INFO_IN_LEN 4
> > +/* sub-operation code info */
> > +#define MC_CMD_SECURE_NIC_INFO_IN_OP_HDR_OFST 0
> > +#define MC_CMD_SECURE_NIC_INFO_IN_OP_HDR_LEN 4
> > +#define MC_CMD_SECURE_NIC_INFO_IN_OP_OFST 0
> > +#define MC_CMD_SECURE_NIC_INFO_IN_OP_LBN 0
> > +#define MC_CMD_SECURE_NIC_INFO_IN_OP_WIDTH 16
> > +/* enum: Get the status of various security settings, all signed along with a
> > + * challenge chosen by the host.
> > + */
> > +#define MC_CMD_SECURE_NIC_INFO_OP_STATUS 0x0
> > +
> > +/* MC_CMD_SECURE_NIC_INFO_IN_STATUS msgrequest */
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_LEN 24
> > +/* sub-operation code, must be MC_CMD_SECURE_NIC_INFO_OP_STATUS */
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_OP_HDR_OFST 0
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_OP_HDR_LEN 4
> > +/* Type of key to be used to sign response. */
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_KEY_TYPE_OFST 4
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_KEY_TYPE_LEN 4
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_UNUSED 0x0 /* enum */
> > +/* enum: Solarflare adapter authentication key, installed by Manftest. */
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_SF_ADAPTER_AUTH 0x1
> > +/* enum: TSA binding key, installed after adapter is bound to a TSA controller.
> > + * This is not supported in firmware which does not support TSA.
> > + */
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_TSA_BINDING 0x2
> > +/* enum: Customer adapter authentication key. Installed by the customer in the
> > + * field, but otherwise similar to the Solarflare adapter authentication key.
> > + */
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CUSTOMER_ADAPTER_AUTH 0x3
> > +/* Random challenge generated by the host. */
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CHALLENGE_OFST 8
> > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CHALLENGE_LEN 16
> > +
> > +/* MC_CMD_SECURE_NIC_INFO_OUT_STATUS msgresponse */
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_LEN 420
> > +/* Length of the signature in MSG_SIGNATURE. */
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN_OFST 0
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN_LEN 4
> > +/* Signature over the message, starting at MESSAGE_TYPE and continuing to the
> > + * end of the MCDI response, allowing the message format to be extended. The
> > + * signature uses ECDSA 384 encoding in ASN.1 format. It has variable length,
> > + * with a maximum of 384 bytes.
> > + */
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_OFST 4
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN 384
> > +/* Enum value indicating the type of response. This protects against chosen
> > + * message attacks. The enum values are random rather than sequential to make
> > + * it unlikely that values will be reused should other commands in a different
> > + * namespace need to create signed messages.
> > + */
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MESSAGE_TYPE_OFST 388
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MESSAGE_TYPE_LEN 4
> > +/* enum: Message type value for the response to a
> > + * MC_CMD_SECURE_NIC_INFO_IN_STATUS message.
> > + */
> > +#define MC_CMD_SECURE_NIC_INFO_STATUS 0xdb4
> > +/* The challenge provided by the host in the MC_CMD_SECURE_NIC_INFO_IN_STATUS
> > + * message
> > + */
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_CHALLENGE_OFST 392
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_CHALLENGE_LEN 16
> > +/* The first 32 bits of XPM memory, which include security and flag bits, die
> > + * ID and chip ID revision. The meaning of these bits is defined in
> > + * mc/include/mc/xpm.h in the firmwaresrc repository.
> > + */
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_XPM_STATUS_BITS_OFST 408
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_XPM_STATUS_BITS_LEN 4
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_A_OFST 412
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_A_LEN 2
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_B_OFST 414
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_B_LEN 2
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_C_OFST 416
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_C_LEN 2
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_D_OFST 418
> > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_D_LEN 2
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_TSA_TEST
> > + * A simple ping-pong command just to test the adapter<>controller MCDI
> > + * communication channel. This command makes not changes to the TSA adapter's
> > + * internal state. It is used by the controller just to verify that the MCDI
> > + * communication channel is working fine. This command takes no additonal
> > + * parameters in request or response.
> > + */
> > +#define MC_CMD_TSA_TEST 0x125
> > +#undef MC_CMD_0x125_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x125_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_TSA_TEST_IN msgrequest */
> > +#define MC_CMD_TSA_TEST_IN_LEN 0
> > +
> > +/* MC_CMD_TSA_TEST_OUT msgresponse */
> > +#define MC_CMD_TSA_TEST_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_TSA_RULESET_OVERRIDE
> > + * Override TSA ruleset that is currently active on the adapter. This operation
> > + * does not modify the ruleset itself. This operation provides a mechanism to
> > + * apply an allow-all or deny-all operation on all packets, thereby completely
> > + * ignoring the rule-set configured on the adapter. The main purpose of this
> > + * operation is to provide a deterministic state to the TSA firewall during
> > + * rule-set transitions.
> > + */
> > +#define MC_CMD_TSA_RULESET_OVERRIDE 0x12a
> > +#undef MC_CMD_0x12a_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x12a_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_TSA_RULESET_OVERRIDE_IN msgrequest */
> > +#define MC_CMD_TSA_RULESET_OVERRIDE_IN_LEN 4
> > +/* The override state to apply. */
> > +#define MC_CMD_TSA_RULESET_OVERRIDE_IN_STATE_OFST 0
> > +#define MC_CMD_TSA_RULESET_OVERRIDE_IN_STATE_LEN 4
> > +/* enum: No override in place - the existing ruleset is in operation. */
> > +#define MC_CMD_TSA_RULESET_OVERRIDE_NONE 0x0
> > +/* enum: Block all packets seen on all datapath channel except those packets
> > + * required for basic configuration of the TSA NIC such as ARPs and TSA-
> > + * communication traffic. Such exceptional traffic is handled differently
> > + * compared to TSA rulesets.
> > + */
> > +#define MC_CMD_TSA_RULESET_OVERRIDE_BLOCK 0x1
> > +/* enum: Allow all packets through all datapath channel. The TSA adapter
> > + * behaves like a normal NIC without any firewalls.
> > + */
> > +#define MC_CMD_TSA_RULESET_OVERRIDE_ALLOW 0x2
> > +
> > +/* MC_CMD_TSA_RULESET_OVERRIDE_OUT msgresponse */
> > +#define MC_CMD_TSA_RULESET_OVERRIDE_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_TSAC_REQUEST
> > + * Generic command to send requests from a TSA controller to a TSA adapter.
> > + * Specific usage is determined by the TYPE field.
> > + */
> > +#define MC_CMD_TSAC_REQUEST 0x12b
> > +#undef MC_CMD_0x12b_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x12b_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_TSAC_REQUEST_IN msgrequest */
> > +#define MC_CMD_TSAC_REQUEST_IN_LEN 4
> > +/* The type of request from the controller. */
> > +#define MC_CMD_TSAC_REQUEST_IN_TYPE_OFST 0
> > +#define MC_CMD_TSAC_REQUEST_IN_TYPE_LEN 4
> > +/* enum: Request the adapter to resend localIP information from it's cache. The
> > + * command does not return any IP address information; IP addresses are sent as
> > + * TSA notifications as descibed in MC_CMD_TSA_INFO_IN_LOCAL_IP.
> > + */
> > +#define MC_CMD_TSAC_REQUEST_LOCALIP 0x0
> > +
> > +/* MC_CMD_TSAC_REQUEST_OUT msgresponse */
> > +#define MC_CMD_TSAC_REQUEST_OUT_LEN 0
> > +
> > +
> > /***********************************/
> > /* MC_CMD_SUC_VERSION
> > * Get the version of the SUC
> > @@ -23477,6 +26408,580 @@
> > #define MC_CMD_SUC_BOOT_VERSION_OUT_VERSION_LEN 4
> >
> >
> > +/***********************************/
> > +/* MC_CMD_SUC_MANFTEST
> > + * Operations to support manftest on SUC based systems.
> > + */
> > +#define MC_CMD_SUC_MANFTEST 0x135
> > +#undef MC_CMD_0x135_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x135_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > +
> > +/* MC_CMD_SUC_MANFTEST_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_IN_LEN 4
> > +/* The manftest operation to be performed. */
> > +#define MC_CMD_SUC_MANFTEST_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_IN_OP_LEN 4
> > +/* enum: Read serial number and use count. */
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ 0x0
> > +/* enum: Update use count on wearout adapter. */
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE 0x1
> > +/* enum: Start an ADC calibration. */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START 0x2
> > +/* enum: Read the status of an ADC calibration. */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS 0x3
> > +/* enum: Read the results of an ADC calibration. */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT 0x4
> > +/* enum: Read the PCIe configuration. */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ 0x5
> > +/* enum: Write the PCIe configuration. */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE 0x6
> > +/* enum: Write FRU information to SUC. The FRU information is taken from the
> > + * FRU_INFORMATION partition. Attempts to write to read-only FRUs are rejected.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_FRU_WRITE 0x7
> > +/* enum: Read UDID Vendor Specific ID from SUC persistent storage. */
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ 0x8
> > +/* enum: Write UDID Vendor Specific ID to SUC persistent storage for use in
> > + * SMBus ARP.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE 0x9
> > +
> > +/* MC_CMD_SUC_MANFTEST_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_OUT_LEN 0
> > +
> > +/* MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_LEN 4
> > +/* The manftest operation to be performed. This must be
> > + * MC_CMD_SUC_MANFTEST_WEAROUT_READ.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_OP_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_LEN 20
> > +/* The serial number of the wearout adapter, see SF-112717-PR for format. */
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_SERIAL_NUMBER_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_SERIAL_NUMBER_LEN 16
> > +/* The use count of the wearout adapter. */
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_USE_COUNT_OFST 16
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_USE_COUNT_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_LEN 4
> > +/* The manftest operation to be performed. This must be
> > + * MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_OP_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_OUT_LEN 0
> > +
> > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_LEN 4
> > +/* The manftest operation to be performed. This must be
> > + * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_OP_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_OUT_LEN 0
> > +
> > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_LEN 4
> > +/* The manftest operation to be performed. This must be
> > + * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_OP_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_LEN 4
> > +/* The combined status of the calibration operation. */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FLAGS_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FLAGS_LEN 4
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_LBN 0
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_WIDTH 1
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_LBN 1
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_WIDTH 1
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_LBN 2
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_WIDTH 4
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_LBN 6
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_WIDTH 2
> > +
> > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_LEN 4
> > +/* The manftest operation to be performed. This must be
> > + * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_OP_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_LEN 12
> > +/* The set of calibration results. */
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_LEN 4
> > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_NUM 3
> > +
> > +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_LEN 4
> > +/* The manftest operation to be performed. This must be
> > + * MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_OP_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_LEN 4
> > +/* The PCIe vendor ID. */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_VENDOR_ID_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_VENDOR_ID_LEN 2
> > +/* The PCIe device ID. */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_DEVICE_ID_OFST 2
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_DEVICE_ID_LEN 2
> > +
> > +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_LEN 8
> > +/* The manftest operation to be performed. This must be
> > + * MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_OP_LEN 4
> > +/* The PCIe vendor ID. */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_VENDOR_ID_OFST 4
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_VENDOR_ID_LEN 2
> > +/* The PCIe device ID. */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_DEVICE_ID_OFST 6
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_DEVICE_ID_LEN 2
> > +
> > +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_OUT_LEN 0
> > +
> > +/* MC_CMD_SUC_MANFTEST_FRU_WRITE_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_LEN 4
> > +/* The manftest operation to be performed. This must be
> > + * MC_CMD_SUC_MANFTEST_FRU_WRITE
> > + */
> > +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_OP_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_FRU_WRITE_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_OUT_LEN 0
> > +
> > +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_LEN 4
> > +/* The manftest operation to be performed. This must be
> > + * MC_CMD_SUC_MANFTEST_SMBUS_ID_READ.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_OP_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_LEN 4
> > +/* The SMBus ID. */
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_SMBUS_ID_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_SMBUS_ID_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN msgrequest */
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_LEN 8
> > +/* The manftest operation to be performed. This must be
> > + * MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE.
> > + */
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_OP_OFST 0
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_OP_LEN 4
> > +/* The SMBus ID. */
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_SMBUS_ID_OFST 4
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_SMBUS_ID_LEN 4
> > +
> > +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_OUT msgresponse */
> > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_GET_CERTIFICATE
> > + * Request a certificate.
> > + */
> > +#define MC_CMD_GET_CERTIFICATE 0x12c
> > +#undef MC_CMD_0x12c_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x12c_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > +
> > +/* MC_CMD_GET_CERTIFICATE_IN msgrequest */
> > +#define MC_CMD_GET_CERTIFICATE_IN_LEN 8
> > +/* Type of the certificate to be retrieved. */
> > +#define MC_CMD_GET_CERTIFICATE_IN_TYPE_OFST 0
> > +#define MC_CMD_GET_CERTIFICATE_IN_TYPE_LEN 4
> > +#define MC_CMD_GET_CERTIFICATE_IN_UNUSED 0x0 /* enum */
> > +#define MC_CMD_GET_CERTIFICATE_IN_AAC 0x1 /* enum */
> > +/* enum: Adapter Authentication Certificate (AAC). The AAC is unique to each
> > + * adapter and is used to verify its authenticity. It is installed by Manftest.
> > + */
> > +#define MC_CMD_GET_CERTIFICATE_IN_ADAPTER_AUTH 0x1
> > +#define MC_CMD_GET_CERTIFICATE_IN_AASC 0x2 /* enum */
> > +/* enum: Adapter Authentication Signing Certificate (AASC). The AASC is shared
> > + * by a group of adapters (typically a purchase order) and is used to verify
> > + * the validity of AAC along with the SF root certificate. It is installed by
> > + * Manftest.
> > + */
> > +#define MC_CMD_GET_CERTIFICATE_IN_ADAPTER_AUTH_SIGNING 0x2
> > +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_AAC 0x3 /* enum */
> > +/* enum: Customer Adapter Authentication Certificate. The Customer AAC is
> > + * unique to each adapter and is used to verify its authenticity in cases where
> > + * either the AAC is not installed or a customer desires to use their own
> > + * certificate chain. It is installed by the customer.
> > + */
> > +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_ADAPTER_AUTH 0x3
> > +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_AASC 0x4 /* enum */
> > +/* enum: Customer Adapter Authentication Certificate. The Customer AASC is
> > + * shared by a group of adapters and is used to verify the validity of the
> > + * Customer AAC along with the customers root certificate. It is installed by
> > + * the customer.
> > + */
> > +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_ADAPTER_AUTH_SIGNING 0x4
> > +/* Offset, measured in bytes, relative to the start of the certificate data
> > + * from which the certificate is to be retrieved.
> > + */
> > +#define MC_CMD_GET_CERTIFICATE_IN_OFFSET_OFST 4
> > +#define MC_CMD_GET_CERTIFICATE_IN_OFFSET_LEN 4
> > +
> > +/* MC_CMD_GET_CERTIFICATE_OUT msgresponse */
> > +#define MC_CMD_GET_CERTIFICATE_OUT_LENMIN 13
> > +#define MC_CMD_GET_CERTIFICATE_OUT_LENMAX 252
> > +#define MC_CMD_GET_CERTIFICATE_OUT_LENMAX_MCDI2 1020
> > +#define MC_CMD_GET_CERTIFICATE_OUT_LEN(num) (12+1*(num))
> > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_NUM(len) (((len)-12)/1)
> > +/* Type of the certificate. */
> > +#define MC_CMD_GET_CERTIFICATE_OUT_TYPE_OFST 0
> > +#define MC_CMD_GET_CERTIFICATE_OUT_TYPE_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MC_CMD_GET_CERTIFICATE_IN/TYPE */
> > +/* Offset, measured in bytes, relative to the start of the certificate data
> > + * from which data in this message starts.
> > + */
> > +#define MC_CMD_GET_CERTIFICATE_OUT_OFFSET_OFST 4
> > +#define MC_CMD_GET_CERTIFICATE_OUT_OFFSET_LEN 4
> > +/* Total length of the certificate data. */
> > +#define MC_CMD_GET_CERTIFICATE_OUT_TOTAL_LENGTH_OFST 8
> > +#define MC_CMD_GET_CERTIFICATE_OUT_TOTAL_LENGTH_LEN 4
> > +/* The certificate data. */
> > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_OFST 12
> > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_LEN 1
> > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MINNUM 1
> > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MAXNUM 240
> > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MAXNUM_MCDI2 1008
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_GET_NIC_GLOBAL
> > + * Get a global value which applies to all PCI functions
> > + */
> > +#define MC_CMD_GET_NIC_GLOBAL 0x12d
> > +#undef MC_CMD_0x12d_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x12d_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > +
> > +/* MC_CMD_GET_NIC_GLOBAL_IN msgrequest */
> > +#define MC_CMD_GET_NIC_GLOBAL_IN_LEN 4
> > +/* Key to request value for, see enum values in MC_CMD_SET_NIC_GLOBAL. If the
> > + * given key is unknown to the current firmware, the call will fail with
> > + * ENOENT.
> > + */
> > +#define MC_CMD_GET_NIC_GLOBAL_IN_KEY_OFST 0
> > +#define MC_CMD_GET_NIC_GLOBAL_IN_KEY_LEN 4
> > +
> > +/* MC_CMD_GET_NIC_GLOBAL_OUT msgresponse */
> > +#define MC_CMD_GET_NIC_GLOBAL_OUT_LEN 4
> > +/* Value of requested key, see key descriptions below. */
> > +#define MC_CMD_GET_NIC_GLOBAL_OUT_VALUE_OFST 0
> > +#define MC_CMD_GET_NIC_GLOBAL_OUT_VALUE_LEN 4
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_SET_NIC_GLOBAL
> > + * Set a global value which applies to all PCI functions. Most global values
> > + * can only be changed under specific conditions, and this call will return an
> > + * appropriate error otherwise (see key descriptions).
> > + */
> > +#define MC_CMD_SET_NIC_GLOBAL 0x12e
> > +#undef MC_CMD_0x12e_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x12e_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_SET_NIC_GLOBAL_IN msgrequest */
> > +#define MC_CMD_SET_NIC_GLOBAL_IN_LEN 8
> > +/* Key to change value of. Firmware will return ENOENT for keys it doesn't know
> > + * about.
> > + */
> > +#define MC_CMD_SET_NIC_GLOBAL_IN_KEY_OFST 0
> > +#define MC_CMD_SET_NIC_GLOBAL_IN_KEY_LEN 4
> > +/* enum: Request switching the datapath firmware sub-variant. Currently only
> > + * useful when running the DPDK f/w variant. See key values below, and the DPDK
> > + * section of the EF10 Driver Writers Guide. Note that any driver attaching
> > + * with the SUBVARIANT_AWARE flag cleared is implicitly considered as a request
> > + * to switch back to the default sub-variant, and will thus reset this value.
> > + * If a sub-variant switch happens, all other PCI functions will get their
> > + * resources reset (they will see an MC reboot).
> > + */
> > +#define MC_CMD_SET_NIC_GLOBAL_IN_FIRMWARE_SUBVARIANT 0x1
> > +/* New value to set, see key descriptions above. */
> > +#define MC_CMD_SET_NIC_GLOBAL_IN_VALUE_OFST 4
> > +#define MC_CMD_SET_NIC_GLOBAL_IN_VALUE_LEN 4
> > +/* enum: Only if KEY = FIRMWARE_SUBVARIANT. Default sub-variant with support
> > + * for maximum features for the current f/w variant. A request from a
> > + * privileged function to set this particular value will always succeed.
> > + */
> > +#define MC_CMD_SET_NIC_GLOBAL_IN_FW_SUBVARIANT_DEFAULT 0x0
> > +/* enum: Only if KEY = FIRMWARE_SUBVARIANT. Increases packet rate at the cost
> > + * of not supporting any TX checksum offloads. Only supported when running some
> > + * f/w variants, others will return ENOTSUP (as reported by the homonymous bit
> > + * in MC_CMD_GET_CAPABILITIES_V2). Can only be set when no other drivers are
> > + * attached, and the calling driver must have no resources allocated. See the
> > + * DPDK section of the EF10 Driver Writers Guide for a more detailed
> > + * description with possible error codes.
> > + */
> > +#define MC_CMD_SET_NIC_GLOBAL_IN_FW_SUBVARIANT_NO_TX_CSUM 0x1
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_LTSSM_TRACE_POLL
> > + * Medford2 hardware has support for logging all LTSSM state transitions to a
> > + * hardware buffer. When built with WITH_LTSSM_TRACE=1, the firmware will
> > + * periodially dump the contents of this hardware buffer to an internal
> > + * firmware buffer for later extraction.
> > + */
> > +#define MC_CMD_LTSSM_TRACE_POLL 0x12f
> > +#undef MC_CMD_0x12f_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x12f_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_LTSSM_TRACE_POLL_IN msgrequest: Read transitions from the firmware
> > + * internal buffer.
> > + */
> > +#define MC_CMD_LTSSM_TRACE_POLL_IN_LEN 4
> > +/* The maximum number of row that the caller can accept. The format of each row
> > + * is defined in MC_CMD_LTSSM_TRACE_POLL_OUT.
> > + */
> > +#define MC_CMD_LTSSM_TRACE_POLL_IN_MAX_ROW_COUNT_OFST 0
> > +#define MC_CMD_LTSSM_TRACE_POLL_IN_MAX_ROW_COUNT_LEN 4
> > +
> > +/* MC_CMD_LTSSM_TRACE_POLL_OUT msgresponse */
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMIN 16
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMAX 248
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMAX_MCDI2 1016
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LEN(num) (8+8*(num))
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_NUM(len) (((len)-8)/8)
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FLAGS_OFST 0
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FLAGS_LEN 4
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_OFST 0
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_LBN 0
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_WIDTH 1
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_OFST 0
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_LBN 1
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_WIDTH 1
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_OFST 0
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_LBN 31
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_WIDTH 1
> > +/* The number of rows present in this response. */
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROW_COUNT_OFST 4
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROW_COUNT_LEN 4
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_OFST 8
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LEN 8
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_OFST 8
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_LEN 4
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_LBN 64
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_WIDTH 32
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_OFST 12
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_LEN 4
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_LBN 96
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_WIDTH 32
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MINNUM 0
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MAXNUM 30
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MAXNUM_MCDI2 126
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_OFST 8
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_LBN 0
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_WIDTH 6
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_OFST 8
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_LBN 6
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_WIDTH 1
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_OFST 8
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_LBN 7
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_WIDTH 1
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_OFST 8
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_LBN 8
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_WIDTH 24
> > +/* The time of the LTSSM transition. Times are reported as fractional
> > + * microseconds since MC boot (wrapping at 2^32us). The fractional part is
> > + * reported in picoseconds. 0 <= TIMESTAMP_PS < 1000000 timestamp in seconds =
> > + * ((TIMESTAMP_US + TIMESTAMP_PS / 1000000) / 1000000)
> > + */
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_US_OFST 12
> > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_US_LEN 4
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_TELEMETRY_ENABLE
> > + * This command enables telemetry processing of packets, allowing a remote host
> > + * to gather information and analytics passing on the card. Enabling telemetry
> > + * will have a performance cost. Not supported on all hardware and datapath
> > + * variants. As of writing, only supported on Medford2 running full-featured
> > + * firmware variant.
> > + */
> > +#define MC_CMD_TELEMETRY_ENABLE 0x138
> > +#undef MC_CMD_0x138_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x138_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_TELEMETRY_ENABLE_IN msgrequest */
> > +#define MC_CMD_TELEMETRY_ENABLE_IN_LEN 4
> > +#define MC_CMD_TELEMETRY_ENABLE_IN_STATE_OFST 0
> > +#define MC_CMD_TELEMETRY_ENABLE_IN_STATE_LEN 4
> > +/* enum: Disables telemetry functionality, returns the card to default
> > + * behaviour of the configured datapath variant.
> > + */
> > +#define MC_CMD_TELEMETRY_ENABLE_IN_DISABLE 0x0
> > +/* enum: Enables telemetry functionality on the currently configured datapath
> > + * variant if supported.
> > + */
> > +#define MC_CMD_TELEMETRY_ENABLE_IN_ENABLE 0x1
> > +
> > +/* MC_CMD_TELEMETRY_ENABLE_OUT msgresponse */
> > +#define MC_CMD_TELEMETRY_ENABLE_OUT_LEN 0
> > +
> > +/* TELEMETRY_CONFIG structuredef */
> > +#define TELEMETRY_CONFIG_LEN 36
> > +/* Bitfields to identify the list of config parameters included in the command.
> > + * A bit-value of 1 indicates that the relevant config parameter field is
> > + * valid; 0 indicates invalid and the config parameter field must be ignored by
> > + * firmware. Firmware may however apply some default values for certain
> > + * parameters.
> > + */
> > +#define TELEMETRY_CONFIG_FLAGS_OFST 0
> > +#define TELEMETRY_CONFIG_FLAGS_LEN 4
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_OFST 0
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_LBN 0
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_WIDTH 1
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_OFST 0
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_LBN 1
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_WIDTH 1
> > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_OFST 0
> > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_LBN 2
> > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_WIDTH 1
> > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_OFST 0
> > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_LBN 3
> > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_WIDTH 1
> > +#define TELEMETRY_CONFIG_RESERVED1_OFST 0
> > +#define TELEMETRY_CONFIG_RESERVED1_LBN 4
> > +#define TELEMETRY_CONFIG_RESERVED1_WIDTH 28
> > +#define TELEMETRY_CONFIG_FLAGS_LBN 0
> > +#define TELEMETRY_CONFIG_FLAGS_WIDTH 32
> > +/* Collector IPv4/IPv6 address to which latency measurements are forwarded from
> > + * the adapter (as bytes in network order; set last 12 bytes to 0 for IPv4
> > + * address).
> > + */
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_OFST 4
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_LEN 16
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_LBN 32
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_WIDTH 128
> > +/* Collector Port number to which latency measurements are forwarded from the
> > + * adapter (as bytes in network order).
> > + */
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_OFST 20
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_LEN 2
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_LBN 160
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_WIDTH 16
> > +/* Unused - set to 0. */
> > +#define TELEMETRY_CONFIG_RESERVED2_OFST 22
> > +#define TELEMETRY_CONFIG_RESERVED2_LEN 2
> > +#define TELEMETRY_CONFIG_RESERVED2_LBN 176
> > +#define TELEMETRY_CONFIG_RESERVED2_WIDTH 16
> > +/* MAC address of the collector (as bytes in network order). */
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_OFST 24
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_LEN 6
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_LBN 192
> > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_WIDTH 48
> > +/* Maximum number of latency measurements to be made on a telemetry flow. */
> > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_OFST 30
> > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_LEN 2
> > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_LBN 240
> > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_WIDTH 16
> > +/* Maximum duration for which a telemetry flow is monitored (in millisecs). */
> > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_OFST 32
> > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_LEN 4
> > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_LBN 256
> > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_WIDTH 32
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_TELEMETRY_CONFIG
> > + * This top-level command includes various sub-opcodes that are used to apply
> > + * (and read-back) telemetry related configuration parameters on the NIC.
> > + * Reference - SF-120569-SW Telemetry Firmware Design.
> > + */
> > +#define MC_CMD_TELEMETRY_CONFIG 0x139
> > +#undef MC_CMD_0x139_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x139_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_TELEMETRY_CONFIG_IN msgrequest */
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_LEN 4
> > +/* Telemetry configuration sub-operation code */
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_OP_OFST 0
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_OP_LEN 4
> > +/* enum: Configure parameters for telemetry measurements. */
> > +#define MC_CMD_TELEMETRY_CONFIG_OP_SET 0x1
> > +/* enum: Read current values of parameters for telemetry measurements. */
> > +#define MC_CMD_TELEMETRY_CONFIG_OP_GET 0x2
> > +
> > +/* MC_CMD_TELEMETRY_CONFIG_IN_SET msgrequest: This command configures the
> > + * parameters necessary for tcp-latency measurements. The adapter adds a filter
> > + * for every new tcp flow seen in both tx and rx directions and tracks the
> > + * telemetry measurements related to the flow in a tracking table. Entries in
> > + * the tracking table live as long as N measurements are made on the flow or
> > + * the flow has been in the tracking table for the maximum configured duration.
> > + * Telemetry measurements in this command refer to tcp-latency measurements for
> > + * data-to-ack latency as well as data-to-data latency. All telemetry
> > + * measurements are bundled into a UDP packet and forwarded to a collector
> > + * whose IP address is configured using this command.
> > + */
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_LEN 40
> > +/* Telemetry configuration sub-operation code. Must be set to
> > + * MC_CMD_TELEMETRY_CONFIG_OP_SET.
> > + */
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_OP_OFST 0
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_OP_LEN 4
> > +/* struct of type TELEMETRY_CONFIG. */
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_PARAMETERS_OFST 4
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_PARAMETERS_LEN 36
> > +
> > +/* MC_CMD_TELEMETRY_CONFIG_OUT_SET msgresponse */
> > +#define MC_CMD_TELEMETRY_CONFIG_OUT_SET_LEN 0
> > +
> > +/* MC_CMD_TELEMETRY_CONFIG_IN_GET msgrequest: This command reads out the
> > + * current values of config parameters necessary for tcp-latency measurements.
> > + * See MC_CMD_TELEMETRY_SET_CONFIG for more information about the configuration
> > + * parameters.
> > + */
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_GET_LEN 4
> > +/* Telemetry configuration sub-operation code. Must be set to
> > + * MC_CMD_TELEMETRY_CONFIG_OP_GET.
> > + */
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_GET_OP_OFST 0
> > +#define MC_CMD_TELEMETRY_CONFIG_IN_GET_OP_LEN 4
> > +
> > +/* MC_CMD_TELEMETRY_CONFIG_OUT_GET msgresponse */
> > +#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_LEN 36
> > +/* struct of type TELEMETRY_CONFIG. */
> > +#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_PARAMETERS_OFST 0
> > +#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_PARAMETERS_LEN 36
> > +
> > +
> > /***********************************/
> > /* MC_CMD_GET_RX_PREFIX_ID
> > * This command is part of the mechanism for configuring the format of the RX
> > @@ -23832,6 +27337,427 @@
> > #define MC_CMD_GET_NCSI_INFO_STATISTICS_OUT_AENS_SENT_OFST 24
> > #define MC_CMD_GET_NCSI_INFO_STATISTICS_OUT_AENS_SENT_LEN 4
> >
> > +
> > +/***********************************/
> > +/* MC_CMD_FIRMWARE_SET_LOCKDOWN
> > + * System lockdown, when enabled firmware updates are blocked.
> > + */
> > +#define MC_CMD_FIRMWARE_SET_LOCKDOWN 0x16f
> > +#undef MC_CMD_0x16f_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x16f_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > +
> > +/* MC_CMD_FIRMWARE_SET_LOCKDOWN_IN msgrequest: This MCDI command is to enable
> > + * only because lockdown can only be disabled by a PMCI command or a cold reset
> > + * of the system.
> > + */
> > +#define MC_CMD_FIRMWARE_SET_LOCKDOWN_IN_LEN 0
> > +
> > +/* MC_CMD_FIRMWARE_SET_LOCKDOWN_OUT msgresponse */
> > +#define MC_CMD_FIRMWARE_SET_LOCKDOWN_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_GET_TEST_FEATURES
> > + * This command returns device details knowledge of which may be required by
> > + * test infrastructure. Although safe, it is not intended to be used by
> > + * production drivers, and the structure returned intentionally has no public
> > + * documentation.
> > + */
> > +#define MC_CMD_GET_TEST_FEATURES 0x1ac
> > +#undef MC_CMD_0x1ac_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x1ac_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > +
> > +/* MC_CMD_GET_TEST_FEATURES_IN msgrequest: Request test features. */
> > +#define MC_CMD_GET_TEST_FEATURES_IN_LEN 0
> > +
> > +/* MC_CMD_GET_TEST_FEATURE_OUT msgresponse */
> > +#define MC_CMD_GET_TEST_FEATURE_OUT_LENMIN 4
> > +#define MC_CMD_GET_TEST_FEATURE_OUT_LENMAX 252
> > +#define MC_CMD_GET_TEST_FEATURE_OUT_LENMAX_MCDI2 1020
> > +#define MC_CMD_GET_TEST_FEATURE_OUT_LEN(num) (0+4*(num))
> > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_NUM(len) (((len)-0)/4)
> > +/* Test-specific NIC information. Production drivers must treat this as opaque.
> > + * The layout is defined in the private TEST_FEATURES_LAYOUT structure.
> > + */
> > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_OFST 0
> > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_LEN 4
> > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MINNUM 1
> > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MAXNUM 63
> > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MAXNUM_MCDI2 255
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_FPGA
> > + * A command to perform various fpga-related operations on platforms that
> > + * include FPGAs. Note that some platforms may only support a subset of these
> > + * operations.
> > + */
> > +#define MC_CMD_FPGA 0x1bf
> > +#undef MC_CMD_0x1bf_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x1bf_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > +
> > +/* MC_CMD_FPGA_IN msgrequest */
> > +#define MC_CMD_FPGA_IN_LEN 4
> > +/* Sub-command code */
> > +#define MC_CMD_FPGA_IN_OP_OFST 0
> > +#define MC_CMD_FPGA_IN_OP_LEN 4
> > +/* enum: Get the FPGA version string. */
> > +#define MC_CMD_FPGA_IN_OP_GET_VERSION 0x0
> > +/* enum: Read bitmask of features supported in the FPGA image. */
> > +#define MC_CMD_FPGA_IN_OP_GET_CAPABILITIES 0x1
> > +/* enum: Perform a FPGA reset. */
> > +#define MC_CMD_FPGA_IN_OP_RESET 0x2
> > +/* enum: Set active flash device. */
> > +#define MC_CMD_FPGA_IN_OP_SELECT_FLASH 0x3
> > +/* enum: Get active flash device. */
> > +#define MC_CMD_FPGA_IN_OP_GET_ACTIVE_FLASH 0x4
> > +/* enum: Configure internal link i.e. the FPGA port facing the ASIC. */
> > +#define MC_CMD_FPGA_IN_OP_SET_INTERNAL_LINK 0x5
> > +/* enum: Read internal link configuration. */
> > +#define MC_CMD_FPGA_IN_OP_GET_INTERNAL_LINK 0x6
> > +/* enum: Get MAC statistics of FPGA external port. */
> > +#define MC_CMD_FPGA_IN_OP_GET_MAC_STATS 0x7
> > +/* enum: Set configuration on internal FPGA MAC. */
> > +#define MC_CMD_FPGA_IN_OP_SET_INTERNAL_MAC 0x8
> > +
> > +/* MC_CMD_FPGA_OP_GET_VERSION_IN msgrequest: Get the FPGA version string. A
> > + * free-format string is returned in response to this command. Any checks on
> > + * supported FPGA operations are based on the response to
> > + * MC_CMD_FPGA_OP_GET_CAPABILITIES.
> > + */
> > +#define MC_CMD_FPGA_OP_GET_VERSION_IN_LEN 4
> > +/* Sub-command code. Must be OP_GET_VERSION */
> > +#define MC_CMD_FPGA_OP_GET_VERSION_IN_OP_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_VERSION_IN_OP_LEN 4
> > +
> > +/* MC_CMD_FPGA_OP_GET_VERSION_OUT msgresponse: Returns the version string. */
> > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMIN 0
> > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMAX 252
> > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMAX_MCDI2 1020
> > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LEN(num) (0+1*(num))
> > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_NUM(len) (((len)-0)/1)
> > +/* Null-terminated string containing version information. */
> > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_LEN 1
> > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MINNUM 0
> > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MAXNUM 252
> > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MAXNUM_MCDI2 1020
> > +
> > +/* MC_CMD_FPGA_OP_GET_CAPABILITIES_IN msgrequest: Read bitmask of features
> > + * supported in the FPGA image.
> > + */
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_LEN 4
> > +/* Sub-command code. Must be OP_GET_CAPABILITIES */
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_OP_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_OP_LEN 4
> > +
> > +/* MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT msgresponse: Returns the version string.
> > + */
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_LEN 4
> > +/* Bit-mask of supported features. */
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_CAPABILITIES_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_CAPABILITIES_LEN 4
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_LBN 0
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_WIDTH 1
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_LBN 1
> > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_WIDTH 1
> > +
> > +/* MC_CMD_FPGA_OP_RESET_IN msgrequest: Perform a FPGA reset operation where
> > + * supported.
> > + */
> > +#define MC_CMD_FPGA_OP_RESET_IN_LEN 4
> > +/* Sub-command code. Must be OP_RESET */
> > +#define MC_CMD_FPGA_OP_RESET_IN_OP_OFST 0
> > +#define MC_CMD_FPGA_OP_RESET_IN_OP_LEN 4
> > +
> > +/* MC_CMD_FPGA_OP_RESET_OUT msgresponse */
> > +#define MC_CMD_FPGA_OP_RESET_OUT_LEN 0
> > +
> > +/* MC_CMD_FPGA_OP_SELECT_FLASH_IN msgrequest: Set active FPGA flash device.
> > + * Returns EINVAL if selected flash index does not exist on the platform under
> > + * test.
> > + */
> > +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_LEN 8
> > +/* Sub-command code. Must be OP_SELECT_FLASH */
> > +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_OP_OFST 0
> > +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_OP_LEN 4
> > +/* Flash device identifier. */
> > +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_FLASH_ID_OFST 4
> > +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_FLASH_ID_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MC_CMD_FPGA_FLASH_INDEX */
> > +
> > +/* MC_CMD_FPGA_OP_SELECT_FLASH_OUT msgresponse */
> > +#define MC_CMD_FPGA_OP_SELECT_FLASH_OUT_LEN 0
> > +
> > +/* MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN msgrequest: Get active FPGA flash device.
> > + */
> > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_LEN 4
> > +/* Sub-command code. Must be OP_GET_ACTIVE_FLASH */
> > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_OP_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_OP_LEN 4
> > +
> > +/* MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT msgresponse: Returns flash identifier
> > + * for current active flash.
> > + */
> > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_LEN 4
> > +/* Flash device identifier. */
> > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_FLASH_ID_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_FLASH_ID_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MC_CMD_FPGA_FLASH_INDEX */
> > +
> > +/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN msgrequest: Configure FPGA internal
> > + * port, facing the ASIC
> > + */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LEN 12
> > +/* Sub-command code. Must be OP_SET_INTERNAL_LINK */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_OP_OFST 0
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_OP_LEN 4
> > +/* Flags */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLAGS_OFST 4
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLAGS_LEN 4
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_OFST 4
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_LBN 0
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_WIDTH 2
> > +/* enum: Unmodified, same as last state set by firmware */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_AUTO 0x0
> > +/* enum: Configure link-up */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_UP 0x1
> > +/* enum: Configure link-down */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_DOWN 0x2
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_OFST 4
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_LBN 2
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_WIDTH 1
> > +/* Link speed to be applied on FPGA internal port MAC. */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_SPEED_OFST 8
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_SPEED_LEN 4
> > +
> > +/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_OUT msgresponse */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_OUT_LEN 0
> > +
> > +/* MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN msgrequest: Read FPGA internal port
> > + * configuration and status
> > + */
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_LEN 4
> > +/* Sub-command code. Must be OP_GET_INTERNAL_LINK */
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_OP_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_OP_LEN 4
> > +
> > +/* MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT msgresponse: Response format for read
> > + * FPGA internal port configuration and status
> > + */
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LEN 8
> > +/* Flags */
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_FLAGS_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_FLAGS_LEN 4
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_LBN 0
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_WIDTH 2
> > +/* Enum values, see field(s): */
> > +/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN/FLAGS */
> > +/* Link speed set on FPGA internal port MAC. */
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_SPEED_OFST 4
> > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_SPEED_LEN 4
> > +
> > +/* MC_CMD_FPGA_OP_GET_MAC_STATS_IN msgrequest: Get FPGA external port MAC
> > + * statistics.
> > + */
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_LEN 4
> > +/* Sub-command code. Must be OP_GET_MAC_STATS. */
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_OP_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_OP_LEN 4
> > +
> > +/* MC_CMD_FPGA_OP_GET_MAC_STATS_OUT msgresponse */
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMIN 4
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMAX 252
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMAX_MCDI2 1020
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LEN(num) (4+8*(num))
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_NUM(len) (((len)-4)/8)
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_NUM_STATS_OFST 0
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_NUM_STATS_LEN 4
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_OFST 4
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LEN 8
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_OFST 4
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_LEN 4
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_LBN 32
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_WIDTH 32
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_OFST 8
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_LEN 4
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_LBN 64
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_WIDTH 32
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MINNUM 0
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MAXNUM 31
> > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MAXNUM_MCDI2 127
> > +#define MC_CMD_FPGA_MAC_TX_TOTAL_PACKETS 0x0 /* enum */
> > +#define MC_CMD_FPGA_MAC_TX_TOTAL_BYTES 0x1 /* enum */
> > +#define MC_CMD_FPGA_MAC_TX_TOTAL_GOOD_PACKETS 0x2 /* enum */
> > +#define MC_CMD_FPGA_MAC_TX_TOTAL_GOOD_BYTES 0x3 /* enum */
> > +#define MC_CMD_FPGA_MAC_TX_BAD_FCS 0x4 /* enum */
> > +#define MC_CMD_FPGA_MAC_TX_PAUSE 0x5 /* enum */
> > +#define MC_CMD_FPGA_MAC_TX_USER_PAUSE 0x6 /* enum */
> > +#define MC_CMD_FPGA_MAC_RX_TOTAL_PACKETS 0x7 /* enum */
> > +#define MC_CMD_FPGA_MAC_RX_TOTAL_BYTES 0x8 /* enum */
> > +#define MC_CMD_FPGA_MAC_RX_TOTAL_GOOD_PACKETS 0x9 /* enum */
> > +#define MC_CMD_FPGA_MAC_RX_TOTAL_GOOD_BYTES 0xa /* enum */
> > +#define MC_CMD_FPGA_MAC_RX_BAD_FCS 0xb /* enum */
> > +#define MC_CMD_FPGA_MAC_RX_PAUSE 0xc /* enum */
> > +#define MC_CMD_FPGA_MAC_RX_USER_PAUSE 0xd /* enum */
> > +#define MC_CMD_FPGA_MAC_RX_UNDERSIZE 0xe /* enum */
> > +#define MC_CMD_FPGA_MAC_RX_OVERSIZE 0xf /* enum */
> > +#define MC_CMD_FPGA_MAC_RX_FRAMING_ERR 0x10 /* enum */
> > +#define MC_CMD_FPGA_MAC_FEC_UNCORRECTED_ERRORS 0x11 /* enum */
> > +#define MC_CMD_FPGA_MAC_FEC_CORRECTED_ERRORS 0x12 /* enum */
> > +
> > +/* MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN msgrequest: Configures the internal port
> > + * MAC on the FPGA.
> > + */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_LEN 20
> > +/* Sub-command code. Must be OP_SET_INTERNAL_MAC. */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_OP_OFST 0
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_OP_LEN 4
> > +/* Select which parameters to configure. */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CONTROL_OFST 4
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CONTROL_LEN 4
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_OFST 4
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_LBN 0
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_WIDTH 1
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_OFST 4
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_LBN 1
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_WIDTH 1
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_OFST 4
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_LBN 2
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_WIDTH 1
> > +/* The MTU to be programmed into the MAC. */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_MTU_OFST 8
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_MTU_LEN 4
> > +/* Drain Tx FIFO */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_DRAIN_OFST 12
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_DRAIN_LEN 4
> > +/* flow control configuration. See MC_CMD_SET_MAC/MC_CMD_SET_MAC_IN/FCNTL. */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_FCNTL_OFST 16
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_FCNTL_LEN 4
> > +
> > +/* MC_CMD_FPGA_OP_SET_INTERNAL_MAC_OUT msgresponse */
> > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE
> > + * This command is expected to be used on a U25 board with an MAE in the FPGA.
> > + * It does not modify the operational state of the NIC. The modes are described
> > + * in XN-200039-TC - U25 OVS packet formats.
> > + */
> > +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE 0x1c0
> > +#undef MC_CMD_0x1c0_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x1c0_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > +
> > +/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_IN msgrequest */
> > +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_IN_LEN 0
> > +
> > +/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT msgresponse */
> > +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_LEN 4
> > +/* The current link mode */
> > +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_MODE_OFST 0
> > +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_MODE_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MC_CMD_EXTERNAL_MAE_LINK_MODE */
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE
> > + * This command is expected to be used on a U25 board with an MAE in the FPGA.
> > + * The modes are described in XN-200039-TC - U25 OVS packet formats. This
> > + * command will set the link between the FPGA and the X2 to the specified new
> > + * mode. It will first enter bootstrap mode, make sure there are no packets in
> > + * flight and then enter the requested mode. In order to make sure there are no
> > + * packets in flight, it will flush the X2 TX path, the FPGA RX path from the
> > + * X2, the FPGA TX path to the X2 and the X2 RX path. The driver is responsible
> > + * for making sure there are no TX or RX descriptors posted on any TXQ or RXQ
> > + * associated with the affected port before invoking this command. This command
> > + * is run implicitly with MODE set to LEGACY when MC_CMD_DRV_ATTACH is
> > + * executed.
> > + */
> > +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE 0x1c1
> > +#undef MC_CMD_0x1c1_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x1c1_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > +
> > +/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN msgrequest */
> > +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_LEN 4
> > +/* The new link mode. */
> > +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_MODE_OFST 0
> > +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_MODE_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MC_CMD_EXTERNAL_MAE_LINK_MODE */
> > +
> > +/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_OUT msgresponse */
> > +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_OUT_LEN 0
> > +
> > +
> > +/***********************************/
> > +/* MC_CMD_GET_BUFTBL_STATS
> > + * Currently EF10 only. Read usage and limits for Buffer Table
> > + */
> > +#define MC_CMD_GET_BUFTBL_STATS 0x6a
> > +#undef MC_CMD_0x6a_PRIVILEGE_CTG
> > +
> > +#define MC_CMD_0x6a_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > +
> > +/* MC_CMD_GET_BUFTBL_STATS_IN msgrequest */
> > +#define MC_CMD_GET_BUFTBL_STATS_IN_LEN 0
> > +
> > +/* MC_CMD_GET_BUFTBL_STATS_OUT msgresponse */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_LEN 40
> > +/* number of buffer table entries per set */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_SET_OFST 0
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_SET_LEN 4
> > +/* number of buffer table entries per cluster */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_CLUSTER_OFST 4
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_CLUSTER_LEN 4
> > +/* Maximum size buffer table can grow to, in clusters. On EF10, this can
> > + * potentially vary depending on the size of the Descriptor Cache.
> > + */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MAX_CLUSTERS_OFST 8
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MAX_CLUSTERS_LEN 4
> > +/* High water mark for number of buffer table clusters which have been
> > + * allocated.
> > + */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HIGH_WATER_CLUSTERS_OFST 12
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HIGH_WATER_CLUSTERS_LEN 4
> > +/* Number of free buffer table clusters on the free cluster list. */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_CLUSTERS_OFST 16
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_CLUSTERS_LEN 4
> > +/* Number of free buffer table sets on the free set list. */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_SETS_OFST 20
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_SETS_LEN 4
> > +/* Number of chunks of fully-used clusters allocated to the MC for EVQ, RXQ and
> > + * TXQs.
> > + */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_FULL_CLUSTERS_OFST 24
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_FULL_CLUSTERS_LEN 4
> > +/* Number of chunks in partially-used clusters allocated to the MC for EVQ, RXQ
> > + * and TXQs.
> > + */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_PART_CLUSTERS_OFST 28
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_PART_CLUSTERS_LEN 4
> > +/* Number of buffer table sets (chunks) allocated to the host via
> > + * MC_CMD_ALLOC_BUFTBL_CHUNK.
> > + */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HOST_SETS_OFST 32
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HOST_SETS_LEN 4
> > +/* Maximum number of VIs per NIC. On EF10 this is the current value as used to
> > + * size the Descriptor Cache in hardware.
> > + */
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_VI_MAX_OFST 36
> > +#define MC_CMD_GET_BUFTBL_STATS_OUT_VI_MAX_LEN 4
> > +
> > /* CLIENT_HANDLE structuredef: A client is an abstract entity that can make
> > * requests of the device and that can own resources managed by the device.
> > * Examples of clients include PCIe functions and dynamic clients. A client
> > @@ -23899,8 +27825,8 @@
> >
> > /* SCHED_CREDIT_CHECK_RESULT structuredef */
> > #define SCHED_CREDIT_CHECK_RESULT_LEN 16
> > -/* The instance of the scheduler. Refer to XN-200389-AW for the location of
> > - * these schedulers in the hardware.
> > +/* The instance of the scheduler. Refer to XN-200389-AW (snic/hnic) and
> > + * XN-200425-TC (cdx) for the location of these schedulers in the hardware.
> > */
> > #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_OFST 0
> > #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_LEN 1
> > @@ -23914,6 +27840,16 @@
> > #define SCHED_CREDIT_CHECK_RESULT_DMAC_H2C 0x7 /* enum */
> > #define SCHED_CREDIT_CHECK_RESULT_HUB_NET_B 0x8 /* enum */
> > #define SCHED_CREDIT_CHECK_RESULT_HUB_NET_REPLAY 0x9 /* enum */
> > +#define SCHED_CREDIT_CHECK_RESULT_ADAPTER_C2H_C 0xa /* enum */
> > +#define SCHED_CREDIT_CHECK_RESULT_A2_H2C_C 0xb /* enum */
> > +#define SCHED_CREDIT_CHECK_RESULT_A3_SOFT_ADAPTOR_C 0xc /* enum */
> > +#define SCHED_CREDIT_CHECK_RESULT_A4_DPU_WRITE_C 0xd /* enum */
> > +#define SCHED_CREDIT_CHECK_RESULT_JRC_RRU 0xe /* enum */
> > +#define SCHED_CREDIT_CHECK_RESULT_CDM_SINK 0xf /* enum */
> > +#define SCHED_CREDIT_CHECK_RESULT_PCIE_SINK 0x10 /* enum */
> > +#define SCHED_CREDIT_CHECK_RESULT_UPORT_SINK 0x11 /* enum */
> > +#define SCHED_CREDIT_CHECK_RESULT_PSX_SINK 0x12 /* enum */
> > +#define SCHED_CREDIT_CHECK_RESULT_A5_DPU_READ_C 0x13 /* enum */
> > #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_LBN 0
> > #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_WIDTH 8
> > /* The type of node that this result refers to. */
> > @@ -23923,6 +27859,10 @@
> > #define SCHED_CREDIT_CHECK_RESULT_DEST 0x0
> > /* enum: Source node */
> > #define SCHED_CREDIT_CHECK_RESULT_SOURCE 0x1
> > +/* enum: Destination node credit type 1 (new to the Keystone schedulers, see
> > + * SF-120268-TC)
> > + */
> > +#define SCHED_CREDIT_CHECK_RESULT_DEST_CREDIT1 0x2
> > #define SCHED_CREDIT_CHECK_RESULT_NODE_TYPE_LBN 8
> > #define SCHED_CREDIT_CHECK_RESULT_NODE_TYPE_WIDTH 8
> > /* Level of node in scheduler hierarchy (level 0 is the bottom of the
> > @@ -26076,6 +30016,26 @@
> > #define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MINNUM 0
> > #define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MAXNUM 4
> > #define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MAXNUM_MCDI2 19
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_OFST 4
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LEN 8
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_OFST 4
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_LEN 4
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_LBN 32
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_WIDTH 32
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_OFST 8
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_LEN 4
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_LBN 64
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_WIDTH 32
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_PF_OFST 4
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_PF_LEN 2
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_VF_OFST 6
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_VF_LEN 2
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_INTF_OFST 8
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_INTF_LEN 4
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_PERSONALITY_OFST 12
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_PERSONALITY_LEN 4
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_LABEL_OFST 16
> > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_LABEL_LEN 40
> >
> >
> > /***********************************/
> > @@ -27350,7 +31310,7 @@
> > /* MAE_MPORT_SELECTOR structuredef: MPORTS are identified by an opaque unsigned
> > * integer value (mport_id) that is guaranteed to be representable within
> > * 32-bits or within any NIC interface field that needs store the value
> > - * (whichever is narrowers). This selector structure provides a stable way to
> > + * (whichever is narrower). This selector structure provides a stable way to
> > * refer to m-ports.
> > */
> > #define MAE_MPORT_SELECTOR_LEN 4
> > @@ -27425,10 +31385,22 @@
> > #define MAE_MPORT_SELECTOR_FLAT_WIDTH 32
> >
> > /* MAE_LINK_ENDPOINT_SELECTOR structuredef: Structure that identifies a real or
> > - * virtual network port by MAE port and link end
> > + * virtual network port by MAE port and link end. Intended to be used by
> > + * network port MCDI commands. Setting FLAT to MAE_LINK_ENDPOINT_COMPAT is
> > + * equivalent to using the previous version of the command. Not all possible
> > + * combinations of MPORT_END and MPORT_SELECTOR in MAE_LINK_ENDPOINT_SELECTOR
> > + * will work in all circumstances. 1. Some will always work (e.g. a VF can
> > + * always address its logical MAC using MPORT_SELECTOR=ASSIGNED,LINK_END=VNIC),
> > + * 2. Some are not meaningful and will always fail with EINVAL (e.g. attempting
> > + * to address the VNIC end of a link to a physical port), 3. Some are
> > + * meaningful but require the MCDI client to have the required permission and
> > + * fail with EPERM otherwise (e.g. trying to set the MAC on a VF the caller
> > + * cannot administer), and 4. Some could be implementation-specific and fail
> > + * with ENOTSUP if not available (no examples exist right now). See
> > + * SF-123581-TC section 4.3 for more details.
> > */
> > #define MAE_LINK_ENDPOINT_SELECTOR_LEN 8
> > -/* The MAE MPORT of interest */
> > +/* Identifier for the MAE MPORT of interest */
> > #define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_OFST 0
> > #define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_LEN 4
> > #define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_LBN 0
> > @@ -27829,6 +31801,8 @@
> > #define MC_CMD_MAE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM_MCDI2 253
> > /* enum: A counter ID that is guaranteed never to represent a real counter */
> > #define MC_CMD_MAE_COUNTER_ALLOC_OUT_COUNTER_ID_NULL 0xffffffff
> > +/* Other enum values, see field(s): */
> > +/* MAE_COUNTER_ID */
> >
> >
> > /***********************************/
> > @@ -28266,6 +32240,24 @@
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_OFST 0
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_LBN 14
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_LBN 15
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_LBN 16
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_LBN 18
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_LBN 19
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_LBN 20
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_WIDTH 1
> > /* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_VLAN0_TCI_BE_OFST 4
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_VLAN0_TCI_BE_LEN 2
> > @@ -28291,19 +32283,23 @@
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DELIVER_OFST 20
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DELIVER_LEN 4
> > /* Allows an action set to trigger several counter updates. Set to
> > - * COUNTER_LIST_ID_NULL to request no counter action.
> > + * MAE_COUNTER_ID_NULL to request no counter action.
> > */
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_LIST_ID_OFST 24
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_LIST_ID_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MAE_COUNTER_ID */
> > /* If a driver only wished to update one counter within this action set, then
> > * it can supply a COUNTER_ID instead of allocating a single-element counter
> > * list. The ID must have been allocated with COUNTER_TYPE=AR. This field
> > - * should be set to COUNTER_ID_NULL if this behaviour is not required. It is
> > - * not valid to supply a non-NULL value for both COUNTER_LIST_ID and
> > + * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
> > + * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
> > * COUNTER_ID.
> > */
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_ID_OFST 28
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_ID_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MAE_COUNTER_ID */
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_MARK_VALUE_OFST 32
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_MARK_VALUE_LEN 4
> > /* Set to MAC_ID_NULL to request no source MAC replacement. */
> > @@ -28347,6 +32343,24 @@
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_OFST 0
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_LBN 14
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_LBN 15
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_LBN 16
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_LBN 18
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_LBN 19
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_LBN 20
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_WIDTH 1
> > /* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_VLAN0_TCI_BE_OFST 4
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_VLAN0_TCI_BE_LEN 2
> > @@ -28372,19 +32386,23 @@
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DELIVER_OFST 20
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DELIVER_LEN 4
> > /* Allows an action set to trigger several counter updates. Set to
> > - * COUNTER_LIST_ID_NULL to request no counter action.
> > + * MAE_COUNTER_ID_NULL to request no counter action.
> > */
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_LIST_ID_OFST 24
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_LIST_ID_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MAE_COUNTER_ID */
> > /* If a driver only wished to update one counter within this action set, then
> > * it can supply a COUNTER_ID instead of allocating a single-element counter
> > * list. The ID must have been allocated with COUNTER_TYPE=AR. This field
> > - * should be set to COUNTER_ID_NULL if this behaviour is not required. It is
> > - * not valid to supply a non-NULL value for both COUNTER_LIST_ID and
> > + * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
> > + * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
> > * COUNTER_ID.
> > */
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_ID_OFST 28
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_ID_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MAE_COUNTER_ID */
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_MARK_VALUE_OFST 32
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_MARK_VALUE_LEN 4
> > /* Set to MAC_ID_NULL to request no source MAC replacement. */
> > @@ -28437,6 +32455,172 @@
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_ECN_ECT_1_TO_CE_LBN 6
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_ECN_ECT_1_TO_CE_WIDTH 1
> >
> > +/* MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN msgrequest: Only supported if
> > + * MAE_ACTION_SET_ALLOC_V3_SUPPORTED is advertised in
> > + * MC_CMD_GET_CAPABILITIES_V10_OUT.
> > + */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LEN 53
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAGS_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAGS_LEN 4
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_LBN 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_WIDTH 2
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_LBN 4
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_WIDTH 2
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_LBN 8
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_LBN 9
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_LBN 10
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_LBN 11
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_LBN 12
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_LBN 13
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_LBN 14
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_LBN 15
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_LBN 16
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_LBN 18
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_LBN 19
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_OFST 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_LBN 20
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_WIDTH 1
> > +/* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_TCI_BE_OFST 4
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_TCI_BE_LEN 2
> > +/* If VLAN_PUSH >= 1, TPID value to be inserted as outermost VLAN. */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_PROTO_BE_OFST 6
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_PROTO_BE_LEN 2
> > +/* If VLAN_PUSH == 2, inner TCI value to be inserted. */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_TCI_BE_OFST 8
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_TCI_BE_LEN 2
> > +/* If VLAN_PUSH == 2, inner TPID value to be inserted. */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_PROTO_BE_OFST 10
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_PROTO_BE_LEN 2
> > +/* Reserved. Ignored by firmware. Should be set to zero or 0xffffffff. */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RSVD_OFST 12
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RSVD_LEN 4
> > +/* Set to ENCAP_HEADER_ID_NULL to request no encap action */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ENCAP_HEADER_ID_OFST 16
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ENCAP_HEADER_ID_LEN 4
> > +/* An m-port selector identifying the m-port that the modified packet should be
> > + * delivered to. Set to MPORT_SELECTOR_NULL to request no delivery of the
> > + * packet.
> > + */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DELIVER_OFST 20
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DELIVER_LEN 4
> > +/* Allows an action set to trigger several counter updates. Set to
> > + * MAE_COUNTER_ID_NULL to request no counter action.
> > + */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_LIST_ID_OFST 24
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_LIST_ID_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MAE_COUNTER_ID */
> > +/* If a driver only wished to update one counter within this action set, then
> > + * it can supply a COUNTER_ID instead of allocating a single-element counter
> > + * list. The ID must have been allocated with COUNTER_TYPE=AR. This field
> > + * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
> > + * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
> > + * COUNTER_ID.
> > + */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_ID_OFST 28
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_ID_LEN 4
> > +/* Enum values, see field(s): */
> > +/* MAE_COUNTER_ID */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_VALUE_OFST 32
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_VALUE_LEN 4
> > +/* Set to MAC_ID_NULL to request no source MAC replacement. */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SRC_MAC_ID_OFST 36
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SRC_MAC_ID_LEN 4
> > +/* Set to MAC_ID_NULL to request no destination MAC replacement. */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DST_MAC_ID_OFST 40
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DST_MAC_ID_LEN 4
> > +/* Source m-port ID to be reported for DO_SET_SRC_MPORT action. */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_REPORTED_SRC_MPORT_OFST 44
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_REPORTED_SRC_MPORT_LEN 4
> > +/* Actions for modifying the Differentiated Services Code-Point (DSCP) bits
> > + * within IPv4 and IPv6 headers.
> > + */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_CONTROL_OFST 48
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_CONTROL_LEN 2
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_OFST 48
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_LBN 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_OFST 48
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_LBN 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_OFST 48
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_LBN 2
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_OFST 48
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_LBN 3
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_WIDTH 6
> > +/* Actions for modifying the Explicit Congestion Notification (ECN) bits within
> > + * IPv4 and IPv6 headers.
> > + */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_CONTROL_OFST 50
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_CONTROL_LEN 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_OFST 50
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_LBN 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_OFST 50
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_LBN 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_OFST 50
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_LBN 2
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_OFST 50
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_LBN 3
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_WIDTH 2
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_OFST 50
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_LBN 5
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_OFST 50
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_LBN 6
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_WIDTH 1
> > +/* Actions for overwriting CH_ROUTE subfields. */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OVERWRITE_OFST 51
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OVERWRITE_LEN 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_OFST 51
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_LBN 0
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_OFST 51
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_LBN 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_OFST 51
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_LBN 2
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_WIDTH 1
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_OFST 51
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_LBN 3
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_WIDTH 1
> > +/* Override outgoing CH_VC to network port for DO_SET_NET_CHAN action. Cannot
> > + * be used in conjunction with DO_SET_SRC_MPORT action.
> > + */
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_NET_CHAN_OFST 52
> > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_NET_CHAN_LEN 1
> > +
> > /* MC_CMD_MAE_ACTION_SET_ALLOC_OUT msgresponse */
> > #define MC_CMD_MAE_ACTION_SET_ALLOC_OUT_LEN 4
> > /* The MSB of the AS_ID is guaranteed to be clear if the ID is not
> > diff --git a/drivers/net/ethernet/sfc/mcdi_vdpa.c b/drivers/net/ethernet/sfc/mcdi_vdpa.c
> > index b9668545ca01..f9ee61b84320 100644
> > --- a/drivers/net/ethernet/sfc/mcdi_vdpa.c
> > +++ b/drivers/net/ethernet/sfc/mcdi_vdpa.c
> > @@ -14,14 +14,6 @@
> > #include "mcdi_vdpa.h"
> > #include "mcdi_pcol.h"
> >
> > -/* The value of target_vf in virtio MC commands like
> > - * virtqueue create, delete and get doorbell offset should
> > - * contain the VF index when the calling function is a PF
> > - * and VF_NULL (0xFFFF) otherwise. As the vDPA driver invokes
> > - * MC commands in context of the VF, it uses VF_NULL.
> > - */
> > -#define MC_CMD_VIRTIO_TARGET_VF_NULL 0xFFFF
> > -
> > struct efx_vring_ctx *efx_vdpa_vring_init(struct efx_nic *efx, u32 vi,
> > enum ef100_vdpa_vq_type vring_type)
> > {
> > @@ -47,7 +39,7 @@ struct efx_vring_ctx *efx_vdpa_vring_init(struct efx_nic *efx, u32 vi,
> > }
> >
> > vring_ctx->efx = efx;
> > - vring_ctx->vf_index = MC_CMD_VIRTIO_TARGET_VF_NULL;
> > + vring_ctx->vf_index = MC_CMD_VIRTIO_INIT_QUEUE_REQ_VF_NULL;
> > vring_ctx->vi_index = vi;
> > vring_ctx->mcdi_vring_type = queue_cmd;
> > return vring_ctx;

2023-03-08 16:41:25

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 06/14] sfc: implement vDPA management device operations

On Tue, Mar 07, 2023 at 05:06:08PM +0530, Gautam Dawar wrote:
> To allow vDPA device creation and deletion, add a vDPA management
> device per function. Currently, the vDPA devices can be created
> only on a VF. Also, for now only network class of vDPA devices
> are supported.
>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/Makefile | 2 +-
> drivers/net/ethernet/sfc/ef10.c | 2 +-
> drivers/net/ethernet/sfc/ef100_nic.c | 27 ++-
> drivers/net/ethernet/sfc/ef100_nic.h | 9 +
> drivers/net/ethernet/sfc/ef100_vdpa.c | 228 ++++++++++++++++++++++
> drivers/net/ethernet/sfc/ef100_vdpa.h | 84 ++++++++
> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 30 +++
> drivers/net/ethernet/sfc/mcdi_functions.c | 9 +-
> drivers/net/ethernet/sfc/mcdi_functions.h | 3 +-
> drivers/net/ethernet/sfc/net_driver.h | 6 +
> 10 files changed, 393 insertions(+), 7 deletions(-)
> create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>
> diff --git a/drivers/net/ethernet/sfc/Makefile b/drivers/net/ethernet/sfc/Makefile
> index 3a2bb98d1c3f..bd8ba588b968 100644
> --- a/drivers/net/ethernet/sfc/Makefile
> +++ b/drivers/net/ethernet/sfc/Makefile
> @@ -12,7 +12,7 @@ sfc-$(CONFIG_SFC_MTD) += mtd.o
> sfc-$(CONFIG_SFC_SRIOV) += sriov.o ef10_sriov.o ef100_sriov.o ef100_rep.o \
> mae.o tc.o tc_bindings.o tc_counters.o
>
> -sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o ef100_vdpa.o
> +sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o ef100_vdpa.o ef100_vdpa_ops.o
> obj-$(CONFIG_SFC) += sfc.o
>
> obj-$(CONFIG_SFC_FALCON) += falcon/
> diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
> index 7022fb2005a2..366ecd3c80b1 100644
> --- a/drivers/net/ethernet/sfc/ef10.c
> +++ b/drivers/net/ethernet/sfc/ef10.c
> @@ -589,7 +589,7 @@ static int efx_ef10_probe(struct efx_nic *efx)
> if (rc)
> goto fail4;
>
> - rc = efx_get_pf_index(efx, &nic_data->pf_index);
> + rc = efx_get_fn_info(efx, &nic_data->pf_index, NULL);
> if (rc)
> goto fail5;
>
> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> index 8a9fff239d07..bda4fcbe1126 100644
> --- a/drivers/net/ethernet/sfc/ef100_nic.c
> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> @@ -1164,7 +1164,7 @@ static int ef100_probe_main(struct efx_nic *efx)
> if (rc)
> goto fail;
>
> - rc = efx_get_pf_index(efx, &nic_data->pf_index);
> + rc = efx_get_fn_info(efx, &nic_data->pf_index, &nic_data->vf_index);
> if (rc)
> goto fail;
>
> @@ -1280,13 +1280,36 @@ int ef100_probe_netdev_pf(struct efx_nic *efx)
>
> int ef100_probe_vf(struct efx_nic *efx)
> {
> - return ef100_probe_main(efx);
> +#if defined(CONFIG_SFC_VDPA)
> + struct ef100_nic_data *nic_data;
> + int err;
> +#endif

This looks like an opportunity to use __maybe_unused in stead of the #ifdef.
See section "Conditional Compilation" in Documentation/process/coding-style.rst

> + int rc;
> +
> + rc = ef100_probe_main(efx);
> + if (rc)
> + return rc;
> +
> +#if defined(CONFIG_SFC_VDPA)

and use IS_ENABLED() here as per that same section.

> + nic_data = efx->nic_data;
> + if (nic_data->vdpa_supported) {
> + err = ef100_vdpa_register_mgmtdev(efx);
> + if (err)
> + pci_warn(efx->pci_dev,
> + "vdpa_register_mgmtdev failed, rc: %d\n", err);
> + }
> +#endif
> + return 0;
> }
>
> void ef100_remove(struct efx_nic *efx)
> {
> struct ef100_nic_data *nic_data = efx->nic_data;
>
> +#if defined(CONFIG_SFC_VDPA)
> + if (nic_data->vdpa_supported)
> + ef100_vdpa_unregister_mgmtdev(efx);
> +#endif

Same comment here.

Martin

> if (IS_ENABLED(CONFIG_SFC_SRIOV) && efx->mae) {
> efx_ef100_fini_reps(efx);
> efx_fini_mae(efx);
> diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h
> index 117a73d0795c..71404bfc2a5a 100644
> --- a/drivers/net/ethernet/sfc/ef100_nic.h
> +++ b/drivers/net/ethernet/sfc/ef100_nic.h
> @@ -68,6 +68,13 @@ enum ef100_bar_config {
> EF100_BAR_CONFIG_VDPA,
> };
>
> +#ifdef CONFIG_SFC_VDPA
> +enum ef100_vdpa_class {
> + EF100_VDPA_CLASS_NONE,
> + EF100_VDPA_CLASS_NET,
> +};
> +#endif
> +
> struct ef100_nic_data {
> struct efx_nic *efx;
> struct efx_buffer mcdi_buf;
> @@ -75,9 +82,11 @@ struct ef100_nic_data {
> u32 datapath_caps2;
> u32 datapath_caps3;
> unsigned int pf_index;
> + unsigned int vf_index;
> u16 warm_boot_count;
> #ifdef CONFIG_SFC_VDPA
> bool vdpa_supported; /* true if vdpa is supported on this PCIe FN */
> + enum ef100_vdpa_class vdpa_class;
> #endif
> u8 port_id[ETH_ALEN];
> DECLARE_BITMAP(evq_phases, EFX_MAX_CHANNELS);
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
> index 268c973f7376..4c5a98c9d6c3 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
> @@ -10,11 +10,17 @@
> #include <linux/err.h>
> #include <linux/vdpa.h>
> #include <linux/virtio_net.h>
> +#include <uapi/linux/vdpa.h>
> #include "ef100_vdpa.h"
> #include "mcdi_vdpa.h"
> #include "mcdi_filters.h"
> #include "ef100_netdev.h"
>
> +static struct virtio_device_id ef100_vdpa_id_table[] = {
> + { .device = VIRTIO_ID_NET, .vendor = PCI_VENDOR_ID_REDHAT_QUMRANET },
> + { 0 },
> +};
> +
> int ef100_vdpa_init(struct efx_probe_data *probe_data)
> {
> struct efx_nic *efx = &probe_data->efx;
> @@ -41,17 +47,239 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data)
> return rc;
> }
>
> +static void ef100_vdpa_delete(struct efx_nic *efx)
> +{
> + if (efx->vdpa_nic) {
> + /* replace with _vdpa_unregister_device later */
> + put_device(&efx->vdpa_nic->vdpa_dev.dev);
> + }
> +}
> +
> void ef100_vdpa_fini(struct efx_probe_data *probe_data)
> {
> struct efx_nic *efx = &probe_data->efx;
> + struct ef100_nic_data *nic_data;
>
> if (efx->state != STATE_VDPA && efx->state != STATE_DISABLED) {
> pci_err(efx->pci_dev, "Invalid efx state %u", efx->state);
> return;
> }
>
> + /* Handle vdpa device deletion, if not done explicitly */
> + ef100_vdpa_delete(efx);
> + nic_data = efx->nic_data;
> + nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
> efx->state = STATE_PROBED;
> down_write(&efx->filter_sem);
> efx_mcdi_filter_table_remove(efx);
> up_write(&efx->filter_sem);
> }
> +
> +static int get_net_config(struct ef100_vdpa_nic *vdpa_nic)
> +{
> + struct efx_nic *efx = vdpa_nic->efx;
> + u16 mtu;
> + int rc;
> +
> + vdpa_nic->net_config.max_virtqueue_pairs =
> + cpu_to_efx_vdpa16(vdpa_nic, vdpa_nic->max_queue_pairs);
> +
> + rc = efx_vdpa_get_mtu(efx, &mtu);
> + if (rc) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: Get MTU for vf:%u failed:%d\n", __func__,
> + vdpa_nic->vf_index, rc);
> + return rc;
> + }
> + vdpa_nic->net_config.mtu = cpu_to_efx_vdpa16(vdpa_nic, mtu);
> + vdpa_nic->net_config.status = cpu_to_efx_vdpa16(vdpa_nic,
> + VIRTIO_NET_S_LINK_UP);
> + return 0;
> +}
> +
> +static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> + const char *dev_name,
> + enum ef100_vdpa_class dev_type,
> + const u8 *mac)
> +{
> + struct ef100_nic_data *nic_data = efx->nic_data;
> + struct ef100_vdpa_nic *vdpa_nic;
> + int rc;
> +
> + nic_data->vdpa_class = dev_type;
> + vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
> + vdpa_dev, &efx->pci_dev->dev,
> + &ef100_vdpa_config_ops,
> + 1, 1,
> + dev_name, false);
> + if (!vdpa_nic) {
> + pci_err(efx->pci_dev,
> + "vDPA device allocation failed for vf: %u\n",
> + nic_data->vf_index);
> + nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + mutex_init(&vdpa_nic->lock);
> + efx->vdpa_nic = vdpa_nic;
> + vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
> + vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
> + vdpa_nic->efx = efx;
> + vdpa_nic->pf_index = nic_data->pf_index;
> + vdpa_nic->vf_index = nic_data->vf_index;
> + vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
> + vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;
> +
> + rc = get_net_config(vdpa_nic);
> + if (rc)
> + goto err_put_device;
> +
> + if (mac) {
> + ether_addr_copy(vdpa_nic->mac_address, mac);
> + vdpa_nic->mac_configured = true;
> + }
> +
> + /* _vdpa_register_device when its ready */
> +
> + return vdpa_nic;
> +
> +err_put_device:
> + /* put_device invokes ef100_vdpa_free */
> + put_device(&vdpa_nic->vdpa_dev.dev);
> + return ERR_PTR(rc);
> +}
> +
> +static void ef100_vdpa_net_dev_del(struct vdpa_mgmt_dev *mgmt_dev,
> + struct vdpa_device *vdev)
> +{
> + struct ef100_nic_data *nic_data;
> + struct efx_nic *efx;
> + int rc;
> +
> + efx = pci_get_drvdata(to_pci_dev(mgmt_dev->device));
> + nic_data = efx->nic_data;
> +
> + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
> + if (rc)
> + pci_err(efx->pci_dev,
> + "set_bar_config EF100 failed, err: %d\n", rc);
> + else
> + pci_dbg(efx->pci_dev,
> + "vdpa net device deleted, vf: %u\n",
> + nic_data->vf_index);
> +}
> +
> +static int ef100_vdpa_net_dev_add(struct vdpa_mgmt_dev *mgmt_dev,
> + const char *name,
> + const struct vdpa_dev_set_config *config)
> +{
> + struct ef100_vdpa_nic *vdpa_nic;
> + struct ef100_nic_data *nic_data;
> + const u8 *mac = NULL;
> + struct efx_nic *efx;
> + int rc, err;
> +
> + if (config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
> + if (!is_valid_ether_addr(config->net.mac)) {
> + pci_err(efx->pci_dev, "Invalid MAC address %pM\n",
> + config->net.mac);
> + return -EINVAL;
> + }
> + mac = (const u8 *)config->net.mac;
> + }
> +
> + efx = pci_get_drvdata(to_pci_dev(mgmt_dev->device));
> + if (efx->vdpa_nic) {
> + pci_warn(efx->pci_dev,
> + "vDPA device already exists on this VF\n");
> + return -EEXIST;
> + }
> +
> + nic_data = efx->nic_data;
> +
> + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_VDPA);
> + if (rc) {
> + pci_err(efx->pci_dev,
> + "set_bar_config vDPA failed, err: %d\n", rc);
> + goto err_set_bar_config;
> + }
> +
> + vdpa_nic = ef100_vdpa_create(efx, name, EF100_VDPA_CLASS_NET, mac);
> + if (IS_ERR(vdpa_nic)) {
> + pci_err(efx->pci_dev,
> + "vDPA device creation failed, vf: %u, err: %ld\n",
> + nic_data->vf_index, PTR_ERR(vdpa_nic));
> + rc = PTR_ERR(vdpa_nic);
> + goto err_set_bar_config;
> + } else {
> + pci_dbg(efx->pci_dev,
> + "vdpa net device created, vf: %u\n",
> + nic_data->vf_index);
> + }
> +
> + return 0;
> +
> +err_set_bar_config:
> + err = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
> + if (err)
> + pci_err(efx->pci_dev,
> + "set_bar_config EF100 failed, err: %d\n", err);
> +
> + return rc;
> +}
> +
> +static const struct vdpa_mgmtdev_ops ef100_vdpa_net_mgmtdev_ops = {
> + .dev_add = ef100_vdpa_net_dev_add,
> + .dev_del = ef100_vdpa_net_dev_del
> +};
> +
> +int ef100_vdpa_register_mgmtdev(struct efx_nic *efx)
> +{
> + struct vdpa_mgmt_dev *mgmt_dev;
> + u64 features;
> + int rc;
> +
> + mgmt_dev = kzalloc(sizeof(*mgmt_dev), GFP_KERNEL);
> + if (!mgmt_dev)
> + return -ENOMEM;
> +
> + rc = efx_vdpa_get_features(efx, EF100_VDPA_DEVICE_TYPE_NET, &features);
> + if (rc) {
> + pci_err(efx->pci_dev, "%s: MCDI get features error:%d\n",
> + __func__, rc);
> + goto err_get_features;
> + }
> +
> + efx->mgmt_dev = mgmt_dev;
> + mgmt_dev->device = &efx->pci_dev->dev;
> + mgmt_dev->id_table = ef100_vdpa_id_table;
> + mgmt_dev->ops = &ef100_vdpa_net_mgmtdev_ops;
> + mgmt_dev->supported_features = features;
> + mgmt_dev->max_supported_vqs = EF100_VDPA_MAX_QUEUES_PAIRS * 2;
> + mgmt_dev->config_attr_mask = BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR);
> +
> + rc = vdpa_mgmtdev_register(mgmt_dev);
> + if (rc) {
> + pci_err(efx->pci_dev,
> + "vdpa_mgmtdev_register failed, err: %d\n", rc);
> + goto err_mgmtdev_register;
> + }
> +
> + return 0;
> +
> +err_mgmtdev_register:
> +err_get_features:
> + kfree(mgmt_dev);
> + efx->mgmt_dev = NULL;
> +
> + return rc;
> +}
> +
> +void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx)
> +{
> + if (efx->mgmt_dev) {
> + vdpa_mgmtdev_unregister(efx->mgmt_dev);
> + kfree(efx->mgmt_dev);
> + efx->mgmt_dev = NULL;
> + }
> +}
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
> index ccc5eb0a2a84..1101b30f56e7 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
> @@ -17,6 +17,24 @@
>
> #if defined(CONFIG_SFC_VDPA)
>
> +/* Max queue pairs currently supported */
> +#define EF100_VDPA_MAX_QUEUES_PAIRS 1
> +
> +/**
> + * enum ef100_vdpa_nic_state - possible states for a vDPA NIC
> + *
> + * @EF100_VDPA_STATE_INITIALIZED: State after vDPA NIC created
> + * @EF100_VDPA_STATE_NEGOTIATED: State after feature negotiation
> + * @EF100_VDPA_STATE_STARTED: State after driver ok
> + * @EF100_VDPA_STATE_NSTATES: Number of VDPA states
> + */
> +enum ef100_vdpa_nic_state {
> + EF100_VDPA_STATE_INITIALIZED,
> + EF100_VDPA_STATE_NEGOTIATED,
> + EF100_VDPA_STATE_STARTED,
> + EF100_VDPA_STATE_NSTATES
> +};
> +
> enum ef100_vdpa_device_type {
> EF100_VDPA_DEVICE_TYPE_NET,
> };
> @@ -27,7 +45,73 @@ enum ef100_vdpa_vq_type {
> EF100_VDPA_VQ_NTYPES
> };
>
> +/**
> + * struct ef100_vdpa_nic - vDPA NIC data structure
> + *
> + * @vdpa_dev: vdpa_device object which registers on the vDPA bus.
> + * @vdpa_state: NIC state machine governed by ef100_vdpa_nic_state
> + * @efx: pointer to the VF's efx_nic object
> + * @lock: Managing access to vdpa config operations
> + * @pf_index: PF index of the vDPA VF
> + * @vf_index: VF index of the vDPA VF
> + * @status: device status as per VIRTIO spec
> + * @features: negotiated feature bits
> + * @max_queue_pairs: maximum number of queue pairs supported
> + * @net_config: virtio_net_config data
> + * @mac_address: mac address of interface associated with this vdpa device
> + * @mac_configured: true after MAC address is configured
> + */
> +struct ef100_vdpa_nic {
> + struct vdpa_device vdpa_dev;
> + enum ef100_vdpa_nic_state vdpa_state;
> + struct efx_nic *efx;
> + /* for synchronizing access to vdpa config operations */
> + struct mutex lock;
> + u32 pf_index;
> + u32 vf_index;
> + u8 status;
> + u64 features;
> + u32 max_queue_pairs;
> + struct virtio_net_config net_config;
> + u8 *mac_address;
> + bool mac_configured;
> +};
> +
> int ef100_vdpa_init(struct efx_probe_data *probe_data);
> void ef100_vdpa_fini(struct efx_probe_data *probe_data);
> +int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
> +void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
> +
> +static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
> +{
> + return virtio_legacy_is_little_endian() ||
> + (vdpa_nic->features & (1ULL << VIRTIO_F_VERSION_1));
> +}
> +
> +static inline u16 efx_vdpa16_to_cpu(struct ef100_vdpa_nic *vdpa_nic,
> + __virtio16 val)
> +{
> + return __virtio16_to_cpu(efx_vdpa_is_little_endian(vdpa_nic), val);
> +}
> +
> +static inline __virtio16 cpu_to_efx_vdpa16(struct ef100_vdpa_nic *vdpa_nic,
> + u16 val)
> +{
> + return __cpu_to_virtio16(efx_vdpa_is_little_endian(vdpa_nic), val);
> +}
> +
> +static inline u32 efx_vdpa32_to_cpu(struct ef100_vdpa_nic *vdpa_nic,
> + __virtio32 val)
> +{
> + return __virtio32_to_cpu(efx_vdpa_is_little_endian(vdpa_nic), val);
> +}
> +
> +static inline __virtio32 cpu_to_efx_vdpa32(struct ef100_vdpa_nic *vdpa_nic,
> + u32 val)
> +{
> + return __cpu_to_virtio32(efx_vdpa_is_little_endian(vdpa_nic), val);
> +}
> +
> +extern const struct vdpa_config_ops ef100_vdpa_config_ops;
> #endif /* CONFIG_SFC_VDPA */
> #endif /* __EF100_VDPA_H__ */
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> new file mode 100644
> index 000000000000..f1ce011adc43
> --- /dev/null
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> @@ -0,0 +1,30 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Driver for AMD network controllers and boards
> + * Copyright(C) 2023, Advanced Micro Devices, Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published
> + * by the Free Software Foundation, incorporated herein by reference.
> + */
> +
> +#include <linux/vdpa.h>
> +#include "ef100_vdpa.h"
> +
> +static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
> +{
> + return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
> +}
> +
> +static void ef100_vdpa_free(struct vdpa_device *vdev)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (vdpa_nic) {
> + mutex_destroy(&vdpa_nic->lock);
> + vdpa_nic->efx->vdpa_nic = NULL;
> + }
> +}
> +
> +const struct vdpa_config_ops ef100_vdpa_config_ops = {
> + .free = ef100_vdpa_free,
> +};
> diff --git a/drivers/net/ethernet/sfc/mcdi_functions.c b/drivers/net/ethernet/sfc/mcdi_functions.c
> index d3e6d8239f5c..4415f19cf68f 100644
> --- a/drivers/net/ethernet/sfc/mcdi_functions.c
> +++ b/drivers/net/ethernet/sfc/mcdi_functions.c
> @@ -413,7 +413,8 @@ int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode)
> return 0;
> }
>
> -int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index)
> +int efx_get_fn_info(struct efx_nic *efx, unsigned int *pf_index,
> + unsigned int *vf_index)
> {
> MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN);
> size_t outlen;
> @@ -426,6 +427,10 @@ int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index)
> if (outlen < sizeof(outbuf))
> return -EIO;
>
> - *pf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_PF);
> + if (pf_index)
> + *pf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_PF);
> +
> + if (efx->type->is_vf && vf_index)
> + *vf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_VF);
> return 0;
> }
> diff --git a/drivers/net/ethernet/sfc/mcdi_functions.h b/drivers/net/ethernet/sfc/mcdi_functions.h
> index b0e2f53a0d9b..76dc0a13463e 100644
> --- a/drivers/net/ethernet/sfc/mcdi_functions.h
> +++ b/drivers/net/ethernet/sfc/mcdi_functions.h
> @@ -28,6 +28,7 @@ void efx_mcdi_rx_remove(struct efx_rx_queue *rx_queue);
> void efx_mcdi_rx_fini(struct efx_rx_queue *rx_queue);
> int efx_fini_dmaq(struct efx_nic *efx);
> int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode);
> -int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index);
> +int efx_get_fn_info(struct efx_nic *efx, unsigned int *pf_index,
> + unsigned int *vf_index);
>
> #endif
> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
> index 3dc9eae5a81d..1da71deac71c 100644
> --- a/drivers/net/ethernet/sfc/net_driver.h
> +++ b/drivers/net/ethernet/sfc/net_driver.h
> @@ -1090,6 +1090,12 @@ struct efx_nic {
> int rx_packet_len_offset;
> int rx_packet_ts_offset;
> bool rx_scatter;
> +#ifdef CONFIG_SFC_VDPA
> + /** @mgmt_dev: vDPA Management device */
> + struct vdpa_mgmt_dev *mgmt_dev;
> + /** @vdpa_nic: vDPA device structure (EF100) */
> + struct ef100_vdpa_nic *vdpa_nic;
> +#endif
> struct efx_rss_context rss_context;
> struct mutex rss_lock;
> u32 vport_id;
> --
> 2.30.1

2023-03-08 16:49:12

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 06/14] sfc: implement vDPA management device operations

On Tue, Mar 07, 2023 at 04:33:52PM +0000, Lucero Palau, Alejandro wrote:
>
> On 3/7/23 11:36, Gautam Dawar wrote:
> > To allow vDPA device creation and deletion, add a vDPA management
> > device per function. Currently, the vDPA devices can be created
> > only on a VF. Also, for now only network class of vDPA devices
> > are supported.
> >
> > Signed-off-by: Gautam Dawar <[email protected]>
> > ---
> > drivers/net/ethernet/sfc/Makefile | 2 +-
> > drivers/net/ethernet/sfc/ef10.c | 2 +-
> > drivers/net/ethernet/sfc/ef100_nic.c | 27 ++-
> > drivers/net/ethernet/sfc/ef100_nic.h | 9 +
> > drivers/net/ethernet/sfc/ef100_vdpa.c | 228 ++++++++++++++++++++++
> > drivers/net/ethernet/sfc/ef100_vdpa.h | 84 ++++++++
> > drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 30 +++
> > drivers/net/ethernet/sfc/mcdi_functions.c | 9 +-
> > drivers/net/ethernet/sfc/mcdi_functions.h | 3 +-
> > drivers/net/ethernet/sfc/net_driver.h | 6 +
> > 10 files changed, 393 insertions(+), 7 deletions(-)
> > create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> >
> > diff --git a/drivers/net/ethernet/sfc/Makefile b/drivers/net/ethernet/sfc/Makefile
> > index 3a2bb98d1c3f..bd8ba588b968 100644
> > --- a/drivers/net/ethernet/sfc/Makefile
> > +++ b/drivers/net/ethernet/sfc/Makefile
> > @@ -12,7 +12,7 @@ sfc-$(CONFIG_SFC_MTD) += mtd.o
> > sfc-$(CONFIG_SFC_SRIOV) += sriov.o ef10_sriov.o ef100_sriov.o ef100_rep.o \
> > mae.o tc.o tc_bindings.o tc_counters.o
> >
> > -sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o ef100_vdpa.o
> > +sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o ef100_vdpa.o ef100_vdpa_ops.o
> > obj-$(CONFIG_SFC) += sfc.o
> >
> > obj-$(CONFIG_SFC_FALCON) += falcon/
> > diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
> > index 7022fb2005a2..366ecd3c80b1 100644
> > --- a/drivers/net/ethernet/sfc/ef10.c
> > +++ b/drivers/net/ethernet/sfc/ef10.c
> > @@ -589,7 +589,7 @@ static int efx_ef10_probe(struct efx_nic *efx)
> > if (rc)
> > goto fail4;
> >
> > - rc = efx_get_pf_index(efx, &nic_data->pf_index);
> > + rc = efx_get_fn_info(efx, &nic_data->pf_index, NULL);
> > if (rc)
> > goto fail5;
> >
> > diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> > index 8a9fff239d07..bda4fcbe1126 100644
> > --- a/drivers/net/ethernet/sfc/ef100_nic.c
> > +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> > @@ -1164,7 +1164,7 @@ static int ef100_probe_main(struct efx_nic *efx)
> > if (rc)
> > goto fail;
> >
> > - rc = efx_get_pf_index(efx, &nic_data->pf_index);
> > + rc = efx_get_fn_info(efx, &nic_data->pf_index, &nic_data->vf_index);
> > if (rc)
> > goto fail;
> >
> > @@ -1280,13 +1280,36 @@ int ef100_probe_netdev_pf(struct efx_nic *efx)
> >
> > int ef100_probe_vf(struct efx_nic *efx)
> > {
> > - return ef100_probe_main(efx);
> > +#if defined(CONFIG_SFC_VDPA)
> > + struct ef100_nic_data *nic_data;
> > + int err;
> > +#endif
> > + int rc;
> > +
> > + rc = ef100_probe_main(efx);
> > + if (rc)
> > + return rc;
> > +
> > +#if defined(CONFIG_SFC_VDPA)
> > + nic_data = efx->nic_data;
> > + if (nic_data->vdpa_supported) {
> > + err = ef100_vdpa_register_mgmtdev(efx);
> > + if (err)
> > + pci_warn(efx->pci_dev,
> > + "vdpa_register_mgmtdev failed, rc: %d\n", err);
>
> isn't this error enough for considering a probe error?

In this case the VF is still completely functional as a normal netdev, but
it cannot be used for vDPA. During probe we do not know what a customer wants
to use this VF for.

Martin

>
> > + }
> > +#endif
> > + return 0;
> > }
> >
> > void ef100_remove(struct efx_nic *efx)
> > {
> > struct ef100_nic_data *nic_data = efx->nic_data;
> >
> > +#if defined(CONFIG_SFC_VDPA)
> > + if (nic_data->vdpa_supported)
> > + ef100_vdpa_unregister_mgmtdev(efx);
> > +#endif
> > if (IS_ENABLED(CONFIG_SFC_SRIOV) && efx->mae) {
> > efx_ef100_fini_reps(efx);
> > efx_fini_mae(efx);
> > diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h
> > index 117a73d0795c..71404bfc2a5a 100644
> > --- a/drivers/net/ethernet/sfc/ef100_nic.h
> > +++ b/drivers/net/ethernet/sfc/ef100_nic.h
> > @@ -68,6 +68,13 @@ enum ef100_bar_config {
> > EF100_BAR_CONFIG_VDPA,
> > };
> >
> > +#ifdef CONFIG_SFC_VDPA
> > +enum ef100_vdpa_class {
> > + EF100_VDPA_CLASS_NONE,
> > + EF100_VDPA_CLASS_NET,
> > +};
> > +#endif
> > +
> > struct ef100_nic_data {
> > struct efx_nic *efx;
> > struct efx_buffer mcdi_buf;
> > @@ -75,9 +82,11 @@ struct ef100_nic_data {
> > u32 datapath_caps2;
> > u32 datapath_caps3;
> > unsigned int pf_index;
> > + unsigned int vf_index;
> > u16 warm_boot_count;
> > #ifdef CONFIG_SFC_VDPA
> > bool vdpa_supported; /* true if vdpa is supported on this PCIe FN */
> > + enum ef100_vdpa_class vdpa_class;
> > #endif
> > u8 port_id[ETH_ALEN];
> > DECLARE_BITMAP(evq_phases, EFX_MAX_CHANNELS);
> > diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
> > index 268c973f7376..4c5a98c9d6c3 100644
> > --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
> > +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
> > @@ -10,11 +10,17 @@
> > #include <linux/err.h>
> > #include <linux/vdpa.h>
> > #include <linux/virtio_net.h>
> > +#include <uapi/linux/vdpa.h>
> > #include "ef100_vdpa.h"
> > #include "mcdi_vdpa.h"
> > #include "mcdi_filters.h"
> > #include "ef100_netdev.h"
> >
> > +static struct virtio_device_id ef100_vdpa_id_table[] = {
> > + { .device = VIRTIO_ID_NET, .vendor = PCI_VENDOR_ID_REDHAT_QUMRANET },
> > + { 0 },
> > +};
> > +
> > int ef100_vdpa_init(struct efx_probe_data *probe_data)
> > {
> > struct efx_nic *efx = &probe_data->efx;
> > @@ -41,17 +47,239 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data)
> > return rc;
> > }
> >
> > +static void ef100_vdpa_delete(struct efx_nic *efx)
> > +{
> > + if (efx->vdpa_nic) {
> > + /* replace with _vdpa_unregister_device later */
> > + put_device(&efx->vdpa_nic->vdpa_dev.dev);
> > + }
> > +}
> > +
> > void ef100_vdpa_fini(struct efx_probe_data *probe_data)
> > {
> > struct efx_nic *efx = &probe_data->efx;
> > + struct ef100_nic_data *nic_data;
> >
> > if (efx->state != STATE_VDPA && efx->state != STATE_DISABLED) {
> > pci_err(efx->pci_dev, "Invalid efx state %u", efx->state);
> > return;
> > }
> >
> > + /* Handle vdpa device deletion, if not done explicitly */
> > + ef100_vdpa_delete(efx);
> > + nic_data = efx->nic_data;
> > + nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
> > efx->state = STATE_PROBED;
> > down_write(&efx->filter_sem);
> > efx_mcdi_filter_table_remove(efx);
> > up_write(&efx->filter_sem);
> > }
> > +
> > +static int get_net_config(struct ef100_vdpa_nic *vdpa_nic)
> > +{
> > + struct efx_nic *efx = vdpa_nic->efx;
> > + u16 mtu;
> > + int rc;
> > +
> > + vdpa_nic->net_config.max_virtqueue_pairs =
> > + cpu_to_efx_vdpa16(vdpa_nic, vdpa_nic->max_queue_pairs);
> > +
> > + rc = efx_vdpa_get_mtu(efx, &mtu);
> > + if (rc) {
> > + dev_err(&vdpa_nic->vdpa_dev.dev,
> > + "%s: Get MTU for vf:%u failed:%d\n", __func__,
> > + vdpa_nic->vf_index, rc);
> > + return rc;
> > + }
> > + vdpa_nic->net_config.mtu = cpu_to_efx_vdpa16(vdpa_nic, mtu);
> > + vdpa_nic->net_config.status = cpu_to_efx_vdpa16(vdpa_nic,
> > + VIRTIO_NET_S_LINK_UP);
> > + return 0;
> > +}
> > +
> > +static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> > + const char *dev_name,
> > + enum ef100_vdpa_class dev_type,
> > + const u8 *mac)
> > +{
> > + struct ef100_nic_data *nic_data = efx->nic_data;
> > + struct ef100_vdpa_nic *vdpa_nic;
> > + int rc;
> > +
> > + nic_data->vdpa_class = dev_type;
> > + vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
> > + vdpa_dev, &efx->pci_dev->dev,
> > + &ef100_vdpa_config_ops,
> > + 1, 1,
> > + dev_name, false);
> > + if (!vdpa_nic) {
> > + pci_err(efx->pci_dev,
> > + "vDPA device allocation failed for vf: %u\n",
> > + nic_data->vf_index);
> > + nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
> > + return ERR_PTR(-ENOMEM);
> > + }
> > +
> > + mutex_init(&vdpa_nic->lock);
> > + efx->vdpa_nic = vdpa_nic;
> > + vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
> > + vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
> > + vdpa_nic->efx = efx;
> > + vdpa_nic->pf_index = nic_data->pf_index;
> > + vdpa_nic->vf_index = nic_data->vf_index;
> > + vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
> > + vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;
> > +
> > + rc = get_net_config(vdpa_nic);
> > + if (rc)
> > + goto err_put_device;
> > +
> > + if (mac) {
> > + ether_addr_copy(vdpa_nic->mac_address, mac);
> > + vdpa_nic->mac_configured = true;
> > + }
> > +
> > + /* _vdpa_register_device when its ready */
> > +
> > + return vdpa_nic;
> > +
> > +err_put_device:
> > + /* put_device invokes ef100_vdpa_free */
> > + put_device(&vdpa_nic->vdpa_dev.dev);
>
> Should not vdpa_nic be released here?
>
> > + return ERR_PTR(rc);
> > +}
> > +
> > +static void ef100_vdpa_net_dev_del(struct vdpa_mgmt_dev *mgmt_dev,
> > + struct vdpa_device *vdev)
> > +{
> > + struct ef100_nic_data *nic_data;
> > + struct efx_nic *efx;
> > + int rc;
> > +
> > + efx = pci_get_drvdata(to_pci_dev(mgmt_dev->device));
> > + nic_data = efx->nic_data;
> > +
> > + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
> > + if (rc)
> > + pci_err(efx->pci_dev,
> > + "set_bar_config EF100 failed, err: %d\n", rc);
> > + else
> > + pci_dbg(efx->pci_dev,
> > + "vdpa net device deleted, vf: %u\n",
> > + nic_data->vf_index);
> > +}
> > +
> > +static int ef100_vdpa_net_dev_add(struct vdpa_mgmt_dev *mgmt_dev,
> > + const char *name,
> > + const struct vdpa_dev_set_config *config)
> > +{
> > + struct ef100_vdpa_nic *vdpa_nic;
> > + struct ef100_nic_data *nic_data;
> > + const u8 *mac = NULL;
> > + struct efx_nic *efx;
> > + int rc, err;
> > +
> > + if (config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
> > + if (!is_valid_ether_addr(config->net.mac)) {
> > + pci_err(efx->pci_dev, "Invalid MAC address %pM\n",
> > + config->net.mac);
> > + return -EINVAL;
> > + }
> > + mac = (const u8 *)config->net.mac;
> > + }
> > +
> > + efx = pci_get_drvdata(to_pci_dev(mgmt_dev->device));
> > + if (efx->vdpa_nic) {
> > + pci_warn(efx->pci_dev,
> > + "vDPA device already exists on this VF\n");
> > + return -EEXIST;
> > + }
> > +
> > + nic_data = efx->nic_data;
> > +
> > + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_VDPA);
> > + if (rc) {
> > + pci_err(efx->pci_dev,
> > + "set_bar_config vDPA failed, err: %d\n", rc);
> > + goto err_set_bar_config;
> > + }
> > +
> > + vdpa_nic = ef100_vdpa_create(efx, name, EF100_VDPA_CLASS_NET, mac);
> > + if (IS_ERR(vdpa_nic)) {
> > + pci_err(efx->pci_dev,
> > + "vDPA device creation failed, vf: %u, err: %ld\n",
> > + nic_data->vf_index, PTR_ERR(vdpa_nic));
> > + rc = PTR_ERR(vdpa_nic);
> > + goto err_set_bar_config;
> > + } else {
> > + pci_dbg(efx->pci_dev,
> > + "vdpa net device created, vf: %u\n",
> > + nic_data->vf_index);
> > + }
> > +
> > + return 0;
> > +
> > +err_set_bar_config:
> > + err = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
> > + if (err)
> > + pci_err(efx->pci_dev,
> > + "set_bar_config EF100 failed, err: %d\n", err);
> > +
> > + return rc;
> > +}
> > +
> > +static const struct vdpa_mgmtdev_ops ef100_vdpa_net_mgmtdev_ops = {
> > + .dev_add = ef100_vdpa_net_dev_add,
> > + .dev_del = ef100_vdpa_net_dev_del
> > +};
> > +
> > +int ef100_vdpa_register_mgmtdev(struct efx_nic *efx)
> > +{
> > + struct vdpa_mgmt_dev *mgmt_dev;
> > + u64 features;
> > + int rc;
> > +
> > + mgmt_dev = kzalloc(sizeof(*mgmt_dev), GFP_KERNEL);
> > + if (!mgmt_dev)
> > + return -ENOMEM;
> > +
> > + rc = efx_vdpa_get_features(efx, EF100_VDPA_DEVICE_TYPE_NET, &features);
> > + if (rc) {
> > + pci_err(efx->pci_dev, "%s: MCDI get features error:%d\n",
> > + __func__, rc);
> > + goto err_get_features;
> > + }
> > +
> > + efx->mgmt_dev = mgmt_dev;
> > + mgmt_dev->device = &efx->pci_dev->dev;
> > + mgmt_dev->id_table = ef100_vdpa_id_table;
> > + mgmt_dev->ops = &ef100_vdpa_net_mgmtdev_ops;
> > + mgmt_dev->supported_features = features;
> > + mgmt_dev->max_supported_vqs = EF100_VDPA_MAX_QUEUES_PAIRS * 2;
> > + mgmt_dev->config_attr_mask = BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR);
> > +
> > + rc = vdpa_mgmtdev_register(mgmt_dev);
> > + if (rc) {
> > + pci_err(efx->pci_dev,
> > + "vdpa_mgmtdev_register failed, err: %d\n", rc);
> > + goto err_mgmtdev_register;
> > + }
> > +
> > + return 0;
> > +
> > +err_mgmtdev_register:
> > +err_get_features:
> > + kfree(mgmt_dev);
> > + efx->mgmt_dev = NULL;
> > +
> > + return rc;
> > +}
> > +
> > +void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx)
> > +{
> > + if (efx->mgmt_dev) {
> > + vdpa_mgmtdev_unregister(efx->mgmt_dev);
> > + kfree(efx->mgmt_dev);
> > + efx->mgmt_dev = NULL;
> > + }
> > +}
> > diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
> > index ccc5eb0a2a84..1101b30f56e7 100644
> > --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
> > +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
> > @@ -17,6 +17,24 @@
> >
> > #if defined(CONFIG_SFC_VDPA)
> >
> > +/* Max queue pairs currently supported */
> > +#define EF100_VDPA_MAX_QUEUES_PAIRS 1
> > +
> > +/**
> > + * enum ef100_vdpa_nic_state - possible states for a vDPA NIC
> > + *
> > + * @EF100_VDPA_STATE_INITIALIZED: State after vDPA NIC created
> > + * @EF100_VDPA_STATE_NEGOTIATED: State after feature negotiation
> > + * @EF100_VDPA_STATE_STARTED: State after driver ok
> > + * @EF100_VDPA_STATE_NSTATES: Number of VDPA states
> > + */
> > +enum ef100_vdpa_nic_state {
> > + EF100_VDPA_STATE_INITIALIZED,
> > + EF100_VDPA_STATE_NEGOTIATED,
> > + EF100_VDPA_STATE_STARTED,
> > + EF100_VDPA_STATE_NSTATES
> > +};
> > +
> > enum ef100_vdpa_device_type {
> > EF100_VDPA_DEVICE_TYPE_NET,
> > };
> > @@ -27,7 +45,73 @@ enum ef100_vdpa_vq_type {
> > EF100_VDPA_VQ_NTYPES
> > };
> >
> > +/**
> > + * struct ef100_vdpa_nic - vDPA NIC data structure
> > + *
> > + * @vdpa_dev: vdpa_device object which registers on the vDPA bus.
> > + * @vdpa_state: NIC state machine governed by ef100_vdpa_nic_state
> > + * @efx: pointer to the VF's efx_nic object
> > + * @lock: Managing access to vdpa config operations
> > + * @pf_index: PF index of the vDPA VF
> > + * @vf_index: VF index of the vDPA VF
> > + * @status: device status as per VIRTIO spec
> > + * @features: negotiated feature bits
> > + * @max_queue_pairs: maximum number of queue pairs supported
> > + * @net_config: virtio_net_config data
> > + * @mac_address: mac address of interface associated with this vdpa device
> > + * @mac_configured: true after MAC address is configured
> > + */
> > +struct ef100_vdpa_nic {
> > + struct vdpa_device vdpa_dev;
> > + enum ef100_vdpa_nic_state vdpa_state;
> > + struct efx_nic *efx;
> > + /* for synchronizing access to vdpa config operations */
> > + struct mutex lock;
> > + u32 pf_index;
> > + u32 vf_index;
> > + u8 status;
> > + u64 features;
> > + u32 max_queue_pairs;
> > + struct virtio_net_config net_config;
> > + u8 *mac_address;
> > + bool mac_configured;
> > +};
> > +
> > int ef100_vdpa_init(struct efx_probe_data *probe_data);
> > void ef100_vdpa_fini(struct efx_probe_data *probe_data);
> > +int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
> > +void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
> > +
> > +static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
> > +{
> > + return virtio_legacy_is_little_endian() ||
> > + (vdpa_nic->features & (1ULL << VIRTIO_F_VERSION_1));
> > +}
> > +
> > +static inline u16 efx_vdpa16_to_cpu(struct ef100_vdpa_nic *vdpa_nic,
> > + __virtio16 val)
> > +{
> > + return __virtio16_to_cpu(efx_vdpa_is_little_endian(vdpa_nic), val);
> > +}
> > +
> > +static inline __virtio16 cpu_to_efx_vdpa16(struct ef100_vdpa_nic *vdpa_nic,
> > + u16 val)
> > +{
> > + return __cpu_to_virtio16(efx_vdpa_is_little_endian(vdpa_nic), val);
> > +}
> > +
> > +static inline u32 efx_vdpa32_to_cpu(struct ef100_vdpa_nic *vdpa_nic,
> > + __virtio32 val)
> > +{
> > + return __virtio32_to_cpu(efx_vdpa_is_little_endian(vdpa_nic), val);
> > +}
> > +
> > +static inline __virtio32 cpu_to_efx_vdpa32(struct ef100_vdpa_nic *vdpa_nic,
> > + u32 val)
> > +{
> > + return __cpu_to_virtio32(efx_vdpa_is_little_endian(vdpa_nic), val);
> > +}
> > +
> > +extern const struct vdpa_config_ops ef100_vdpa_config_ops;
> > #endif /* CONFIG_SFC_VDPA */
> > #endif /* __EF100_VDPA_H__ */
> > diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> > new file mode 100644
> > index 000000000000..f1ce011adc43
> > --- /dev/null
> > +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> > @@ -0,0 +1,30 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/* Driver for AMD network controllers and boards
> > + * Copyright(C) 2023, Advanced Micro Devices, Inc.
> > + *
> > + * This program is free software; you can redistribute it and/or modify it
> > + * under the terms of the GNU General Public License version 2 as published
> > + * by the Free Software Foundation, incorporated herein by reference.
> > + */
> > +
> > +#include <linux/vdpa.h>
> > +#include "ef100_vdpa.h"
> > +
> > +static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
> > +{
> > + return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
> > +}
> > +
> > +static void ef100_vdpa_free(struct vdpa_device *vdev)
> > +{
> > + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> > +
> > + if (vdpa_nic) {
> > + mutex_destroy(&vdpa_nic->lock);
> > + vdpa_nic->efx->vdpa_nic = NULL;
> > + }
> > +}
> > +
> > +const struct vdpa_config_ops ef100_vdpa_config_ops = {
> > + .free = ef100_vdpa_free,
> > +};
> > diff --git a/drivers/net/ethernet/sfc/mcdi_functions.c b/drivers/net/ethernet/sfc/mcdi_functions.c
> > index d3e6d8239f5c..4415f19cf68f 100644
> > --- a/drivers/net/ethernet/sfc/mcdi_functions.c
> > +++ b/drivers/net/ethernet/sfc/mcdi_functions.c
> > @@ -413,7 +413,8 @@ int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode)
> > return 0;
> > }
> >
> > -int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index)
> > +int efx_get_fn_info(struct efx_nic *efx, unsigned int *pf_index,
> > + unsigned int *vf_index)
> > {
> > MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN);
> > size_t outlen;
> > @@ -426,6 +427,10 @@ int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index)
> > if (outlen < sizeof(outbuf))
> > return -EIO;
> >
> > - *pf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_PF);
> > + if (pf_index)
> > + *pf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_PF);
> > +
> > + if (efx->type->is_vf && vf_index)
> > + *vf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_VF);
> > return 0;
> > }
> > diff --git a/drivers/net/ethernet/sfc/mcdi_functions.h b/drivers/net/ethernet/sfc/mcdi_functions.h
> > index b0e2f53a0d9b..76dc0a13463e 100644
> > --- a/drivers/net/ethernet/sfc/mcdi_functions.h
> > +++ b/drivers/net/ethernet/sfc/mcdi_functions.h
> > @@ -28,6 +28,7 @@ void efx_mcdi_rx_remove(struct efx_rx_queue *rx_queue);
> > void efx_mcdi_rx_fini(struct efx_rx_queue *rx_queue);
> > int efx_fini_dmaq(struct efx_nic *efx);
> > int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode);
> > -int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index);
> > +int efx_get_fn_info(struct efx_nic *efx, unsigned int *pf_index,
> > + unsigned int *vf_index);
> >
> > #endif
> > diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
> > index 3dc9eae5a81d..1da71deac71c 100644
> > --- a/drivers/net/ethernet/sfc/net_driver.h
> > +++ b/drivers/net/ethernet/sfc/net_driver.h
> > @@ -1090,6 +1090,12 @@ struct efx_nic {
> > int rx_packet_len_offset;
> > int rx_packet_ts_offset;
> > bool rx_scatter;
> > +#ifdef CONFIG_SFC_VDPA
> > + /** @mgmt_dev: vDPA Management device */
> > + struct vdpa_mgmt_dev *mgmt_dev;
> > + /** @vdpa_nic: vDPA device structure (EF100) */
> > + struct ef100_vdpa_nic *vdpa_nic;
> > +#endif
> > struct efx_rss_context rss_context;
> > struct mutex rss_lock;
> > u32 vport_id;

2023-03-08 17:06:42

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 08/14] sfc: implement vdpa vring config operations

On Tue, Mar 07, 2023 at 05:06:10PM +0530, Gautam Dawar wrote:
> This patch implements the vDPA config operations related to
> virtqueues or vrings. These include setting vring address,
> getting vq state, operations to enable/disable a vq etc.
> The resources required for vring operations eg. VI, interrupts etc.
> are also allocated.
>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/ef100_vdpa.c | 46 +++-
> drivers/net/ethernet/sfc/ef100_vdpa.h | 54 +++++
> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 275 ++++++++++++++++++++++
> 3 files changed, 374 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
> index 4c5a98c9d6c3..c66e5aef69ea 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
> @@ -14,6 +14,7 @@
> #include "ef100_vdpa.h"
> #include "mcdi_vdpa.h"
> #include "mcdi_filters.h"
> +#include "mcdi_functions.h"
> #include "ef100_netdev.h"
>
> static struct virtio_device_id ef100_vdpa_id_table[] = {
> @@ -47,12 +48,31 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data)
> return rc;
> }
>
> +static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)
> +{
> + /* The first VI is reserved for MCDI
> + * 1 VI each for rx + tx ring
> + */
> + unsigned int max_vis = 1 + EF100_VDPA_MAX_QUEUES_PAIRS;
> + unsigned int min_vis = 1 + 1;
> + int rc;
> +
> + rc = efx_mcdi_alloc_vis(efx, min_vis, max_vis,
> + NULL, allocated_vis);
> + if (!rc)
> + return rc;
> + if (*allocated_vis < min_vis)
> + return -ENOSPC;
> + return 0;
> +}
> +
> static void ef100_vdpa_delete(struct efx_nic *efx)
> {
> if (efx->vdpa_nic) {
> /* replace with _vdpa_unregister_device later */
> put_device(&efx->vdpa_nic->vdpa_dev.dev);
> }
> + efx_mcdi_free_vis(efx);
> }
>
> void ef100_vdpa_fini(struct efx_probe_data *probe_data)
> @@ -104,9 +124,19 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> {
> struct ef100_nic_data *nic_data = efx->nic_data;
> struct ef100_vdpa_nic *vdpa_nic;
> + unsigned int allocated_vis;
> int rc;
> + u8 i;
>
> nic_data->vdpa_class = dev_type;
> + rc = vdpa_allocate_vis(efx, &allocated_vis);
> + if (rc) {
> + pci_err(efx->pci_dev,
> + "%s Alloc VIs failed for vf:%u error:%d\n",
> + __func__, nic_data->vf_index, rc);
> + return ERR_PTR(rc);
> + }
> +
> vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
> vdpa_dev, &efx->pci_dev->dev,
> &ef100_vdpa_config_ops,
> @@ -117,7 +147,8 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> "vDPA device allocation failed for vf: %u\n",
> nic_data->vf_index);
> nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
> - return ERR_PTR(-ENOMEM);
> + rc = -ENOMEM;
> + goto err_alloc_vis_free;
> }
>
> mutex_init(&vdpa_nic->lock);
> @@ -125,11 +156,21 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
> vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
> vdpa_nic->efx = efx;
> + vdpa_nic->max_queue_pairs = allocated_vis - 1;
> vdpa_nic->pf_index = nic_data->pf_index;
> vdpa_nic->vf_index = nic_data->vf_index;
> vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
> vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;
>
> + for (i = 0; i < (2 * vdpa_nic->max_queue_pairs); i++) {
> + rc = ef100_vdpa_init_vring(vdpa_nic, i);
> + if (rc) {
> + pci_err(efx->pci_dev,
> + "vring init idx: %u failed, rc: %d\n", i, rc);
> + goto err_put_device;
> + }
> + }
> +
> rc = get_net_config(vdpa_nic);
> if (rc)
> goto err_put_device;
> @@ -146,6 +187,9 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> err_put_device:
> /* put_device invokes ef100_vdpa_free */
> put_device(&vdpa_nic->vdpa_dev.dev);
> +
> +err_alloc_vis_free:
> + efx_mcdi_free_vis(efx);
> return ERR_PTR(rc);
> }
>
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
> index dcf4a8156415..348ca8a7404b 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
> @@ -32,6 +32,21 @@
> /* Alignment requirement of the Virtqueue */
> #define EF100_VDPA_VQ_ALIGN 4096
>
> +/* Vring configuration definitions */
> +#define EF100_VRING_ADDRESS_CONFIGURED 0x1
> +#define EF100_VRING_SIZE_CONFIGURED 0x10
> +#define EF100_VRING_READY_CONFIGURED 0x100
> +#define EF100_VRING_CONFIGURED (EF100_VRING_ADDRESS_CONFIGURED | \
> + EF100_VRING_SIZE_CONFIGURED | \
> + EF100_VRING_READY_CONFIGURED)
> +#define EF100_VRING_CREATED 0x1000

I only see these defines used a bit masks. So why skip all the bits
in stead of using 0x2, 0x4, 0x8 respectively?

Martin

> +
> +/* Maximum size of msix name */
> +#define EF100_VDPA_MAX_MSIX_NAME_SIZE 256
> +
> +/* Default high IOVA for MCDI buffer */
> +#define EF100_VDPA_IOVA_BASE_ADDR 0x20000000000
> +
> /**
> * enum ef100_vdpa_nic_state - possible states for a vDPA NIC
> *
> @@ -57,6 +72,41 @@ enum ef100_vdpa_vq_type {
> EF100_VDPA_VQ_NTYPES
> };
>
> +/**
> + * struct ef100_vdpa_vring_info - vDPA vring data structure
> + *
> + * @desc: Descriptor area address of the vring
> + * @avail: Available area address of the vring
> + * @used: Device area address of the vring
> + * @size: Number of entries in the vring
> + * @vring_state: bit map to track vring configuration
> + * @last_avail_idx: last available index of the vring
> + * @last_used_idx: last used index of the vring
> + * @doorbell_offset: doorbell offset
> + * @doorbell_offset_valid: true if @doorbell_offset is updated
> + * @vring_type: type of vring created
> + * @vring_ctx: vring context information
> + * @msix_name: device name for vring irq handler
> + * @irq: irq number for vring irq handler
> + * @cb: callback for vring interrupts
> + */
> +struct ef100_vdpa_vring_info {
> + dma_addr_t desc;
> + dma_addr_t avail;
> + dma_addr_t used;
> + u32 size;
> + u16 vring_state;
> + u32 last_avail_idx;
> + u32 last_used_idx;
> + u32 doorbell_offset;
> + bool doorbell_offset_valid;
> + enum ef100_vdpa_vq_type vring_type;
> + struct efx_vring_ctx *vring_ctx;
> + char msix_name[EF100_VDPA_MAX_MSIX_NAME_SIZE];
> + u32 irq;
> + struct vdpa_callback cb;
> +};
> +
> /**
> * struct ef100_vdpa_nic - vDPA NIC data structure
> *
> @@ -70,6 +120,7 @@ enum ef100_vdpa_vq_type {
> * @features: negotiated feature bits
> * @max_queue_pairs: maximum number of queue pairs supported
> * @net_config: virtio_net_config data
> + * @vring: vring information of the vDPA device.
> * @mac_address: mac address of interface associated with this vdpa device
> * @mac_configured: true after MAC address is configured
> * @cfg_cb: callback for config change
> @@ -86,6 +137,7 @@ struct ef100_vdpa_nic {
> u64 features;
> u32 max_queue_pairs;
> struct virtio_net_config net_config;
> + struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
> u8 *mac_address;
> bool mac_configured;
> struct vdpa_callback cfg_cb;
> @@ -95,6 +147,8 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data);
> void ef100_vdpa_fini(struct efx_probe_data *probe_data);
> int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
> void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
> +void ef100_vdpa_irq_vectors_free(void *data);
> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>
> static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
> {
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> index a2364ef9f492..0051c4c0e47c 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> @@ -9,13 +9,270 @@
>
> #include <linux/vdpa.h>
> #include "ef100_vdpa.h"
> +#include "io.h"
> #include "mcdi_vdpa.h"
>
> +/* Get the queue's function-local index of the associated VI
> + * virtqueue number queue 0 is reserved for MCDI
> + */
> +#define EFX_GET_VI_INDEX(vq_num) (((vq_num) / 2) + 1)
> +
> static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
> {
> return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
> }
>
> +void ef100_vdpa_irq_vectors_free(void *data)
> +{
> + pci_free_irq_vectors(data);
> +}
> +
> +static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + struct efx_vring_ctx *vring_ctx;
> + u32 vi_index;
> +
> + if (idx % 2) /* Even VQ for RX and odd for TX */
> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_TYPE_NET_TXQ;
> + else
> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_TYPE_NET_RXQ;
> + vi_index = EFX_GET_VI_INDEX(idx);
> + vring_ctx = efx_vdpa_vring_init(vdpa_nic->efx, vi_index,
> + vdpa_nic->vring[idx].vring_type);
> + if (IS_ERR(vring_ctx))
> + return PTR_ERR(vring_ctx);
> +
> + vdpa_nic->vring[idx].vring_ctx = vring_ctx;
> + return 0;
> +}
> +
> +static void delete_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + efx_vdpa_vring_fini(vdpa_nic->vring[idx].vring_ctx);
> + vdpa_nic->vring[idx].vring_ctx = NULL;
> +}
> +
> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
> + vdpa_nic->vring[idx].vring_state = 0;
> + vdpa_nic->vring[idx].last_avail_idx = 0;
> + vdpa_nic->vring[idx].last_used_idx = 0;
> +}
> +
> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + u32 offset;
> + int rc;
> +
> + vdpa_nic->vring[idx].irq = -EINVAL;
> + rc = create_vring_ctx(vdpa_nic, idx);
> + if (rc) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: create_vring_ctx failed, idx:%u, err:%d\n",
> + __func__, idx, rc);
> + return rc;
> + }
> +
> + rc = efx_vdpa_get_doorbell_offset(vdpa_nic->vring[idx].vring_ctx,
> + &offset);
> + if (rc) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: get_doorbell failed idx:%u, err:%d\n",
> + __func__, idx, rc);
> + goto err_get_doorbell_offset;
> + }
> + vdpa_nic->vring[idx].doorbell_offset = offset;
> + vdpa_nic->vring[idx].doorbell_offset_valid = true;
> +
> + return 0;
> +
> +err_get_doorbell_offset:
> + delete_vring_ctx(vdpa_nic, idx);
> + return rc;
> +}
> +
> +static bool is_qid_invalid(struct ef100_vdpa_nic *vdpa_nic, u16 idx,
> + const char *caller)
> +{
> + if (unlikely(idx >= (vdpa_nic->max_queue_pairs * 2))) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: Invalid qid %u\n", caller, idx);
> + return true;
> + }
> + return false;
> +}
> +
> +static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
> + u16 idx, u64 desc_area, u64 driver_area,
> + u64 device_area)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return -EINVAL;
> +
> + mutex_lock(&vdpa_nic->lock);
> + vdpa_nic->vring[idx].desc = desc_area;
> + vdpa_nic->vring[idx].avail = driver_area;
> + vdpa_nic->vring[idx].used = device_area;
> + vdpa_nic->vring[idx].vring_state |= EF100_VRING_ADDRESS_CONFIGURED;
> + mutex_unlock(&vdpa_nic->lock);
> + return 0;
> +}
> +
> +static void ef100_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return;
> +
> + if (!is_power_of_2(num)) {
> + dev_err(&vdev->dev, "%s: Index:%u size:%u not power of 2\n",
> + __func__, idx, num);
> + return;
> + }
> + if (num > EF100_VDPA_VQ_NUM_MAX_SIZE) {
> + dev_err(&vdev->dev, "%s: Index:%u size:%u more than max:%u\n",
> + __func__, idx, num, EF100_VDPA_VQ_NUM_MAX_SIZE);
> + return;
> + }
> + mutex_lock(&vdpa_nic->lock);
> + vdpa_nic->vring[idx].size = num;
> + vdpa_nic->vring[idx].vring_state |= EF100_VRING_SIZE_CONFIGURED;
> + mutex_unlock(&vdpa_nic->lock);
> +}
> +
> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + u32 idx_val;
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return;
> +
> + if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
> + return;
> +
> + idx_val = idx;
> + _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
> + vdpa_nic->vring[idx].doorbell_offset);
> +}
> +
> +static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
> + struct vdpa_callback *cb)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return;
> +
> + if (cb)
> + vdpa_nic->vring[idx].cb = *cb;
> +}
> +
> +static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
> + bool ready)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return;
> +
> + mutex_lock(&vdpa_nic->lock);
> + if (ready) {
> + vdpa_nic->vring[idx].vring_state |=
> + EF100_VRING_READY_CONFIGURED;
> + } else {
> + vdpa_nic->vring[idx].vring_state &=
> + ~EF100_VRING_READY_CONFIGURED;
> + }
> + mutex_unlock(&vdpa_nic->lock);
> +}
> +
> +static bool ef100_vdpa_get_vq_ready(struct vdpa_device *vdev, u16 idx)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + bool ready;
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return false;
> +
> + mutex_lock(&vdpa_nic->lock);
> + ready = vdpa_nic->vring[idx].vring_state & EF100_VRING_READY_CONFIGURED;
> + mutex_unlock(&vdpa_nic->lock);
> + return ready;
> +}
> +
> +static int ef100_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx,
> + const struct vdpa_vq_state *state)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return -EINVAL;
> +
> + mutex_lock(&vdpa_nic->lock);
> + vdpa_nic->vring[idx].last_avail_idx = state->split.avail_index;
> + vdpa_nic->vring[idx].last_used_idx = state->split.avail_index;
> + mutex_unlock(&vdpa_nic->lock);
> + return 0;
> +}
> +
> +static int ef100_vdpa_get_vq_state(struct vdpa_device *vdev,
> + u16 idx, struct vdpa_vq_state *state)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return -EINVAL;
> +
> + mutex_lock(&vdpa_nic->lock);
> + state->split.avail_index = (u16)vdpa_nic->vring[idx].last_used_idx;
> + mutex_unlock(&vdpa_nic->lock);
> +
> + return 0;
> +}
> +
> +static struct vdpa_notification_area
> + ef100_vdpa_get_vq_notification(struct vdpa_device *vdev,
> + u16 idx)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + struct vdpa_notification_area notify_area = {0, 0};
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + goto end;
> +
> + mutex_lock(&vdpa_nic->lock);
> + notify_area.addr = (uintptr_t)(vdpa_nic->efx->membase_phys +
> + vdpa_nic->vring[idx].doorbell_offset);
> + /* VDPA doorbells are at a stride of VI/2
> + * One VI stride is shared by both rx & tx doorbells
> + */
> + notify_area.size = vdpa_nic->efx->vi_stride / 2;
> + mutex_unlock(&vdpa_nic->lock);
> +
> +end:
> + return notify_area;
> +}
> +
> +static int ef100_get_vq_irq(struct vdpa_device *vdev, u16 idx)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + u32 irq;
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return -EINVAL;
> +
> + mutex_lock(&vdpa_nic->lock);
> + irq = vdpa_nic->vring[idx].irq;
> + mutex_unlock(&vdpa_nic->lock);
> +
> + return irq;
> +}
> +
> static u32 ef100_vdpa_get_vq_align(struct vdpa_device *vdev)
> {
> return EF100_VDPA_VQ_ALIGN;
> @@ -80,6 +337,8 @@ static void ef100_vdpa_set_config_cb(struct vdpa_device *vdev,
>
> if (cb)
> vdpa_nic->cfg_cb = *cb;
> + else
> + memset(&vdpa_nic->cfg_cb, 0, sizeof(vdpa_nic->cfg_cb));
> }
>
> static u16 ef100_vdpa_get_vq_num_max(struct vdpa_device *vdev)
> @@ -137,14 +396,30 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
> static void ef100_vdpa_free(struct vdpa_device *vdev)
> {
> struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + int i;
>
> if (vdpa_nic) {
> + for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
> + reset_vring(vdpa_nic, i);
> + if (vdpa_nic->vring[i].vring_ctx)
> + delete_vring_ctx(vdpa_nic, i);
> + }
> mutex_destroy(&vdpa_nic->lock);
> vdpa_nic->efx->vdpa_nic = NULL;
> }
> }
>
> const struct vdpa_config_ops ef100_vdpa_config_ops = {
> + .set_vq_address = ef100_vdpa_set_vq_address,
> + .set_vq_num = ef100_vdpa_set_vq_num,
> + .kick_vq = ef100_vdpa_kick_vq,
> + .set_vq_cb = ef100_vdpa_set_vq_cb,
> + .set_vq_ready = ef100_vdpa_set_vq_ready,
> + .get_vq_ready = ef100_vdpa_get_vq_ready,
> + .set_vq_state = ef100_vdpa_set_vq_state,
> + .get_vq_state = ef100_vdpa_get_vq_state,
> + .get_vq_notification = ef100_vdpa_get_vq_notification,
> + .get_vq_irq = ef100_get_vq_irq,
> .get_vq_align = ef100_vdpa_get_vq_align,
> .get_device_features = ef100_vdpa_get_device_features,
> .set_driver_features = ef100_vdpa_set_driver_features,
> --
> 2.30.1

2023-03-08 18:01:38

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 11/14] sfc: use PF's IOMMU domain for running VF's MCDI commands

On Tue, Mar 07, 2023 at 05:06:13PM +0530, Gautam Dawar wrote:
> This changeset uses MC_CMD_CLIENT_CMD to execute VF's MCDI
> commands when running in vDPA mode (STATE_VDPA).
> Also, use the PF's IOMMU domain for executing the encapsulated
> VF's MCDI commands to isolate DMA of guest buffers in the VF's
> IOMMU domain.
> This patch also updates the PCIe FN's client id in the efx_nic
> structure which is required while running MC_CMD_CLIENT_CMD.
>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/ef100.c | 1 +
> drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++
> drivers/net/ethernet/sfc/mcdi.c | 108 ++++++++++++++++++++++----
> drivers/net/ethernet/sfc/mcdi.h | 2 +-
> drivers/net/ethernet/sfc/net_driver.h | 2 +
> drivers/net/ethernet/sfc/ptp.c | 4 +-
> 6 files changed, 132 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
> index c1c69783db7b..8453c9ba0f41 100644
> --- a/drivers/net/ethernet/sfc/ef100.c
> +++ b/drivers/net/ethernet/sfc/ef100.c
> @@ -465,6 +465,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
> efx->type = (const struct efx_nic_type *)entry->driver_data;
>
> efx->pci_dev = pci_dev;
> + efx->client_id = MC_CMD_CLIENT_ID_SELF;
> pci_set_drvdata(pci_dev, efx);
> rc = efx_init_struct(efx, pci_dev);
> if (rc)
> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> index bda4fcbe1126..cd9f724a9e64 100644
> --- a/drivers/net/ethernet/sfc/ef100_nic.c
> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> @@ -206,9 +206,11 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
> "firmware reports num_mac_stats = %u\n",
> efx->num_mac_stats);
>
> +#ifdef CONFIG_SFC_VDPA

More opportunities to use IS_ENABLED(CONFIG_SFC_VDPA) in this patch
in stead of the #ifdef.

Martin

> nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
> CLIENT_CMD_VF_PROXY) &&
> efx->type->is_vf;
> +#endif
> return 0;
> }
>
> @@ -1086,6 +1088,35 @@ static int ef100_check_design_params(struct efx_nic *efx)
> return rc;
> }
>
> +static int efx_ef100_update_client_id(struct efx_nic *efx)
> +{
> + struct ef100_nic_data *nic_data = efx->nic_data;
> + unsigned int pf_index = PCIE_FUNCTION_PF_NULL;
> + unsigned int vf_index = PCIE_FUNCTION_VF_NULL;
> + efx_qword_t pciefn;
> + int rc;
> +
> + if (efx->pci_dev->is_virtfn)
> + vf_index = nic_data->vf_index;
> + else
> + pf_index = nic_data->pf_index;
> +
> + /* Construct PCIE_FUNCTION structure */
> + EFX_POPULATE_QWORD_3(pciefn,
> + PCIE_FUNCTION_PF, pf_index,
> + PCIE_FUNCTION_VF, vf_index,
> + PCIE_FUNCTION_INTF, PCIE_INTERFACE_CALLER);
> + /* look up self client ID */
> + rc = efx_ef100_lookup_client_id(efx, pciefn, &efx->client_id);
> + if (rc) {
> + pci_warn(efx->pci_dev,
> + "%s: Failed to get client ID, rc %d\n",
> + __func__, rc);
> + }
> +
> + return rc;
> +}
> +
> /* NIC probe and remove
> */
> static int ef100_probe_main(struct efx_nic *efx)
> @@ -1173,6 +1204,10 @@ static int ef100_probe_main(struct efx_nic *efx)
> goto fail;
> efx->port_num = rc;
>
> + rc = efx_ef100_update_client_id(efx);
> + if (rc)
> + goto fail;
> +
> efx_mcdi_print_fwver(efx, fw_version, sizeof(fw_version));
> pci_dbg(efx->pci_dev, "Firmware version %s\n", fw_version);
>
> diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
> index a7f2c31071e8..3bf1ebe05775 100644
> --- a/drivers/net/ethernet/sfc/mcdi.c
> +++ b/drivers/net/ethernet/sfc/mcdi.c
> @@ -145,14 +145,15 @@ void efx_mcdi_fini(struct efx_nic *efx)
> kfree(efx->mcdi);
> }
>
> -static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
> - const efx_dword_t *inbuf, size_t inlen)
> +static void efx_mcdi_send_request(struct efx_nic *efx, u32 client_id,
> + unsigned int cmd, const efx_dword_t *inbuf,
> + size_t inlen)
> {
> struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
> #ifdef CONFIG_SFC_MCDI_LOGGING
> char *buf = mcdi->logging_buffer; /* page-sized */
> #endif
> - efx_dword_t hdr[2];
> + efx_dword_t hdr[5];
> size_t hdr_len;
> u32 xflags, seqno;
>
> @@ -179,7 +180,7 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
> MCDI_HEADER_XFLAGS, xflags,
> MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
> hdr_len = 4;
> - } else {
> + } else if (client_id == efx->client_id) {
> /* MCDI v2 */
> BUG_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
> EFX_POPULATE_DWORD_7(hdr[0],
> @@ -194,6 +195,35 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
> MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
> MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
> hdr_len = 8;
> + } else {
> + /* MCDI v2 */
> + WARN_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
> + /* MCDI v2 with credentials of a different client */
> + BUILD_BUG_ON(MC_CMD_CLIENT_CMD_IN_LEN != 4);
> + /* Outer CLIENT_CMD wrapper command with client ID */
> + EFX_POPULATE_DWORD_7(hdr[0],
> + MCDI_HEADER_RESPONSE, 0,
> + MCDI_HEADER_RESYNC, 1,
> + MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
> + MCDI_HEADER_DATALEN, 0,
> + MCDI_HEADER_SEQ, seqno,
> + MCDI_HEADER_XFLAGS, xflags,
> + MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
> + EFX_POPULATE_DWORD_2(hdr[1],
> + MC_CMD_V2_EXTN_IN_EXTENDED_CMD,
> + MC_CMD_CLIENT_CMD,
> + MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen + 12);
> + MCDI_SET_DWORD(&hdr[2],
> + CLIENT_CMD_IN_CLIENT_ID, client_id);
> +
> + /* MCDIv2 header for inner command */
> + EFX_POPULATE_DWORD_2(hdr[3],
> + MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
> + MCDI_HEADER_DATALEN, 0);
> + EFX_POPULATE_DWORD_2(hdr[4],
> + MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
> + MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
> + hdr_len = 20;
> }
>
> #ifdef CONFIG_SFC_MCDI_LOGGING
> @@ -474,7 +504,8 @@ static void efx_mcdi_release(struct efx_mcdi_iface *mcdi)
> &mcdi->async_list, struct efx_mcdi_async_param, list);
> if (async) {
> mcdi->state = MCDI_STATE_RUNNING_ASYNC;
> - efx_mcdi_send_request(efx, async->cmd,
> + efx_mcdi_send_request(efx, efx->client_id,
> + async->cmd,
> (const efx_dword_t *)(async + 1),
> async->inlen);
> mod_timer(&mcdi->async_timer,
> @@ -797,7 +828,7 @@ static int efx_mcdi_proxy_wait(struct efx_nic *efx, u32 handle, bool quiet)
> return mcdi->proxy_rx_status;
> }
>
> -static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
> +static int _efx_mcdi_rpc(struct efx_nic *efx, u32 client_id, unsigned int cmd,
> const efx_dword_t *inbuf, size_t inlen,
> efx_dword_t *outbuf, size_t outlen,
> size_t *outlen_actual, bool quiet, int *raw_rc)
> @@ -811,7 +842,7 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
> return -EINVAL;
> }
>
> - rc = efx_mcdi_rpc_start(efx, cmd, inbuf, inlen);
> + rc = efx_mcdi_rpc_start(efx, client_id, cmd, inbuf, inlen);
> if (rc)
> return rc;
>
> @@ -836,7 +867,8 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
>
> /* We now retry the original request. */
> mcdi->state = MCDI_STATE_RUNNING_SYNC;
> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
> + efx_mcdi_send_request(efx, efx->client_id, cmd,
> + inbuf, inlen);
>
> rc = _efx_mcdi_rpc_finish(efx, cmd, inlen,
> outbuf, outlen, outlen_actual,
> @@ -855,16 +887,44 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
> return rc;
> }
>
> +#ifdef CONFIG_SFC_VDPA
> +static bool is_mode_vdpa(struct efx_nic *efx)
> +{
> + if (efx->pci_dev->is_virtfn &&
> + efx->pci_dev->physfn &&
> + efx->state == STATE_VDPA &&
> + efx->vdpa_nic)
> + return true;
> +
> + return false;
> +}
> +#endif
> +
> static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
> const efx_dword_t *inbuf, size_t inlen,
> efx_dword_t *outbuf, size_t outlen,
> size_t *outlen_actual, bool quiet)
> {
> +#ifdef CONFIG_SFC_VDPA
> + struct efx_nic *efx_pf;
> +#endif
> int raw_rc = 0;
> int rc;
>
> - rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
> - outbuf, outlen, outlen_actual, true, &raw_rc);
> +#ifdef CONFIG_SFC_VDPA
> + if (is_mode_vdpa(efx)) {
> + efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
> + rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd, inbuf,
> + inlen, outbuf, outlen, outlen_actual,
> + true, &raw_rc);
> + } else {
> +#endif
> + rc = _efx_mcdi_rpc(efx, efx->client_id, cmd, inbuf,
> + inlen, outbuf, outlen, outlen_actual, true,
> + &raw_rc);
> +#ifdef CONFIG_SFC_VDPA
> + }
> +#endif
>
> if ((rc == -EPROTO) && (raw_rc == MC_CMD_ERR_NO_EVB_PORT) &&
> efx->type->is_vf) {
> @@ -881,9 +941,22 @@ static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
>
> do {
> usleep_range(delay_us, delay_us + 10000);
> - rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
> - outbuf, outlen, outlen_actual,
> - true, &raw_rc);
> +#ifdef CONFIG_SFC_VDPA
> + if (is_mode_vdpa(efx)) {
> + efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
> + rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd,
> + inbuf, inlen, outbuf, outlen,
> + outlen_actual, true,
> + &raw_rc);
> + } else {
> +#endif
> + rc = _efx_mcdi_rpc(efx, efx->client_id,
> + cmd, inbuf, inlen, outbuf,
> + outlen, outlen_actual, true,
> + &raw_rc);
> +#ifdef CONFIG_SFC_VDPA
> + }
> +#endif
> if (delay_us < 100000)
> delay_us <<= 1;
> } while ((rc == -EPROTO) &&
> @@ -939,7 +1012,7 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
> * function and is then responsible for calling efx_mcdi_display_error
> * as needed.
> */
> -int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
> +int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned int cmd,
> const efx_dword_t *inbuf, size_t inlen,
> efx_dword_t *outbuf, size_t outlen,
> size_t *outlen_actual)
> @@ -948,7 +1021,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
> outlen_actual, true);
> }
>
> -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
> +int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
> const efx_dword_t *inbuf, size_t inlen)
> {
> struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
> @@ -965,7 +1038,7 @@ int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
> return -ENETDOWN;
>
> efx_mcdi_acquire_sync(mcdi);
> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
> + efx_mcdi_send_request(efx, client_id, cmd, inbuf, inlen);
> return 0;
> }
>
> @@ -1009,7 +1082,8 @@ static int _efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd,
> */
> if (mcdi->async_list.next == &async->list &&
> efx_mcdi_acquire_async(mcdi)) {
> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
> + efx_mcdi_send_request(efx, efx->client_id,
> + cmd, inbuf, inlen);
> mod_timer(&mcdi->async_timer,
> jiffies + MCDI_RPC_TIMEOUT);
> }
> diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
> index dafab52aaef7..2c526d2edeb6 100644
> --- a/drivers/net/ethernet/sfc/mcdi.h
> +++ b/drivers/net/ethernet/sfc/mcdi.h
> @@ -150,7 +150,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
> efx_dword_t *outbuf, size_t outlen,
> size_t *outlen_actual);
>
> -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
> +int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
> const efx_dword_t *inbuf, size_t inlen);
> int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
> efx_dword_t *outbuf, size_t outlen,
> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
> index 1da71deac71c..948c7a06403a 100644
> --- a/drivers/net/ethernet/sfc/net_driver.h
> +++ b/drivers/net/ethernet/sfc/net_driver.h
> @@ -859,6 +859,7 @@ struct efx_mae;
> * @secondary_list: List of &struct efx_nic instances for the secondary PCI
> * functions of the controller, if this is for the primary function.
> * Serialised by rtnl_lock.
> + * @client_id: client ID of this PCIe function
> * @type: Controller type attributes
> * @legacy_irq: IRQ number
> * @workqueue: Workqueue for port reconfigures and the HW monitor.
> @@ -1022,6 +1023,7 @@ struct efx_nic {
> struct list_head secondary_list;
> struct pci_dev *pci_dev;
> unsigned int port_num;
> + u32 client_id;
> const struct efx_nic_type *type;
> int legacy_irq;
> bool eeh_disabled_legacy_irq;
> diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
> index 9f07e1ba7780..d90d4f6b3824 100644
> --- a/drivers/net/ethernet/sfc/ptp.c
> +++ b/drivers/net/ethernet/sfc/ptp.c
> @@ -1052,8 +1052,8 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
>
> /* Clear flag that signals MC ready */
> WRITE_ONCE(*start, 0);
> - rc = efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf,
> - MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
> + rc = efx_mcdi_rpc_start(efx, MC_CMD_CLIENT_ID_SELF, MC_CMD_PTP,
> + synch_buf, MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
> EFX_WARN_ON_ONCE_PARANOID(rc);
>
> /* Wait for start from MCDI (or timeout) */
> --
> 2.30.1

2023-03-10 05:05:27

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 04/14] sfc: evaluate vdpa support based on FW capability CLIENT_CMD_VF_PROXY

On Tue, Mar 7, 2023 at 7:37 PM Gautam Dawar <[email protected]> wrote:
>
> Add and update vdpa_supported field to struct efx_nic to true if
> running Firmware supports CLIENT_CMD_VF_PROXY capability. This is
> required to ensure DMA isolation between MCDI command buffer and guest
> buffers.
>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/ef100_netdev.c | 26 +++++++++++++++---
> drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++----------------
> drivers/net/ethernet/sfc/ef100_nic.h | 6 +++--
> drivers/net/ethernet/sfc/ef100_vdpa.h | 5 ++--
> 4 files changed, 41 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c
> index d916877b5a9a..5d93e870d9b7 100644
> --- a/drivers/net/ethernet/sfc/ef100_netdev.c
> +++ b/drivers/net/ethernet/sfc/ef100_netdev.c
> @@ -355,6 +355,28 @@ void ef100_remove_netdev(struct efx_probe_data *probe_data)
> efx->state = STATE_PROBED;
> }
>
> +static void efx_ef100_update_tso_features(struct efx_nic *efx)
> +{
> + struct ef100_nic_data *nic_data = efx->nic_data;
> + struct net_device *net_dev = efx->net_dev;
> + netdev_features_t tso;
> +
> + if (!efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3))
> + return;
> +
> + tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
> + NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
> + NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
> +
> + net_dev->features |= tso;
> + net_dev->hw_features |= tso;
> + net_dev->hw_enc_features |= tso;
> + /* EF100 HW can only offload outer checksums if they are UDP,
> + * so for GRE_CSUM we have to use GSO_PARTIAL.
> + */
> + net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
> +}

I don't see a direct relationship between vDPA and the TSO capability.
Is this an independent fix?

> +
> int ef100_probe_netdev(struct efx_probe_data *probe_data)
> {
> struct efx_nic *efx = &probe_data->efx;
> @@ -387,9 +409,7 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
> ESE_EF100_DP_GZ_TSO_MAX_HDR_NUM_SEGS_DEFAULT);
> efx->mdio.dev = net_dev;
>
> - rc = efx_ef100_init_datapath_caps(efx);
> - if (rc < 0)
> - goto fail;
> + efx_ef100_update_tso_features(efx);
>
> rc = ef100_phy_probe(efx);
> if (rc)
> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> index 8cbe5e0f4bdf..ef6e295efcf7 100644
> --- a/drivers/net/ethernet/sfc/ef100_nic.c
> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> @@ -161,7 +161,7 @@ int ef100_get_mac_address(struct efx_nic *efx, u8 *mac_address,
> return 0;
> }
>
> -int efx_ef100_init_datapath_caps(struct efx_nic *efx)
> +static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
> {
> MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_V7_OUT_LEN);
> struct ef100_nic_data *nic_data = efx->nic_data;
> @@ -197,25 +197,15 @@ int efx_ef100_init_datapath_caps(struct efx_nic *efx)
> if (rc)
> return rc;
>
> - if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) {
> - struct net_device *net_dev = efx->net_dev;
> - netdev_features_t tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
> - NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
> - NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
> -
> - net_dev->features |= tso;
> - net_dev->hw_features |= tso;
> - net_dev->hw_enc_features |= tso;
> - /* EF100 HW can only offload outer checksums if they are UDP,
> - * so for GRE_CSUM we have to use GSO_PARTIAL.
> - */
> - net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
> - }
> efx->num_mac_stats = MCDI_WORD(outbuf,
> GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS);
> netif_dbg(efx, probe, efx->net_dev,
> "firmware reports num_mac_stats = %u\n",
> efx->num_mac_stats);
> +
> + nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
> + CLIENT_CMD_VF_PROXY) &&
> + efx->type->is_vf;
> return 0;
> }
>
> @@ -806,13 +796,6 @@ static char *bar_config_name[] = {
> [EF100_BAR_CONFIG_VDPA] = "vDPA",
> };
>
> -#ifdef CONFIG_SFC_VDPA
> -static bool efx_vdpa_supported(struct efx_nic *efx)
> -{
> - return efx->type->is_vf;
> -}
> -#endif
> -
> int efx_ef100_set_bar_config(struct efx_nic *efx,
> enum ef100_bar_config new_config)
> {
> @@ -828,7 +811,7 @@ int efx_ef100_set_bar_config(struct efx_nic *efx,
>
> #ifdef CONFIG_SFC_VDPA
> /* Current EF100 hardware supports vDPA on VFs only */
> - if (new_config == EF100_BAR_CONFIG_VDPA && !efx_vdpa_supported(efx)) {
> + if (new_config == EF100_BAR_CONFIG_VDPA && !nic_data->vdpa_supported) {
> pci_err(efx->pci_dev, "vdpa over PF not supported : %s",
> efx->name);
> return -EOPNOTSUPP;
> @@ -1208,6 +1191,12 @@ static int ef100_probe_main(struct efx_nic *efx)
> goto fail;
> }
>
> + rc = efx_ef100_init_datapath_caps(efx);
> + if (rc) {
> + pci_info(efx->pci_dev, "Unable to initialize datapath caps\n");
> + goto fail;
> + }
> +
> return 0;
> fail:
> return rc;
> diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h
> index 4562982f2965..117a73d0795c 100644
> --- a/drivers/net/ethernet/sfc/ef100_nic.h
> +++ b/drivers/net/ethernet/sfc/ef100_nic.h
> @@ -76,6 +76,9 @@ struct ef100_nic_data {
> u32 datapath_caps3;
> unsigned int pf_index;
> u16 warm_boot_count;
> +#ifdef CONFIG_SFC_VDPA
> + bool vdpa_supported; /* true if vdpa is supported on this PCIe FN */
> +#endif
> u8 port_id[ETH_ALEN];
> DECLARE_BITMAP(evq_phases, EFX_MAX_CHANNELS);
> enum ef100_bar_config bar_config;
> @@ -95,9 +98,8 @@ struct ef100_nic_data {
> };
>
> #define efx_ef100_has_cap(caps, flag) \
> - (!!((caps) & BIT_ULL(MC_CMD_GET_CAPABILITIES_V4_OUT_ ## flag ## _LBN)))
> + (!!((caps) & BIT_ULL(MC_CMD_GET_CAPABILITIES_V7_OUT_ ## flag ## _LBN)))
>
> -int efx_ef100_init_datapath_caps(struct efx_nic *efx);
> int ef100_phy_probe(struct efx_nic *efx);
> int ef100_filter_table_probe(struct efx_nic *efx);
>
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
> index f6564448d0c7..90062fd8a25d 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
> @@ -1,7 +1,6 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> -/* Driver for Xilinx network controllers and boards
> - * Copyright (C) 2020-2022, Xilinx, Inc.
> - * Copyright (C) 2022, Advanced Micro Devices, Inc.
> +/* Driver for AMD network controllers and boards
> + * Copyright (C) 2023, Advanced Micro Devices, Inc.

Let's fix this in the patch that introduces this.

Thanks



> *
> * This program is free software; you can redistribute it and/or modify it
> * under the terms of the GNU General Public License version 2 as published
> --
> 2.30.1
>


2023-03-10 05:05:31

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 01/14] sfc: add function personality support for EF100 devices

On Tue, Mar 7, 2023 at 7:36 PM Gautam Dawar <[email protected]> wrote:
>
> A function personality defines the location and semantics of
> registers in the BAR. EF100 NICs allow different personalities
> of a PCIe function and changing it at run-time. A total of three
> function personalities are defined as of now: EF100, vDPA and
> None with EF100 being the default.
> For now, vDPA net devices can be created on a EF100 virtual
> function and the VF personality will be changed to vDPA in the
> process.
>
> Co-developed-by: Martin Habets <[email protected]>
> Signed-off-by: Martin Habets <[email protected]>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/ef100.c | 6 +-
> drivers/net/ethernet/sfc/ef100_nic.c | 98 +++++++++++++++++++++++++++-
> drivers/net/ethernet/sfc/ef100_nic.h | 11 ++++
> 3 files changed, 111 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
> index 71aab3d0480f..c1c69783db7b 100644
> --- a/drivers/net/ethernet/sfc/ef100.c
> +++ b/drivers/net/ethernet/sfc/ef100.c
> @@ -429,8 +429,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
> if (!efx)
> return;
>
> - probe_data = container_of(efx, struct efx_probe_data, efx);
> - ef100_remove_netdev(probe_data);
> + efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_NONE);
> #ifdef CONFIG_SFC_SRIOV
> efx_fini_struct_tc(efx);
> #endif
> @@ -443,6 +442,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
> pci_disable_pcie_error_reporting(pci_dev);
>
> pci_set_drvdata(pci_dev, NULL);
> + probe_data = container_of(efx, struct efx_probe_data, efx);
> efx_fini_struct(efx);
> kfree(probe_data);
> };
> @@ -508,7 +508,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
> goto fail;
>
> efx->state = STATE_PROBED;
> - rc = ef100_probe_netdev(probe_data);
> + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
> if (rc)
> goto fail;
>
> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> index 4dc643b0d2db..8cbe5e0f4bdf 100644
> --- a/drivers/net/ethernet/sfc/ef100_nic.c
> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> @@ -772,6 +772,99 @@ static int efx_ef100_get_base_mport(struct efx_nic *efx)
> return 0;
> }
>
> +/* BAR configuration.
> + * To change BAR configuration, tear down the current configuration (which
> + * leaves the hardware in the PROBED state), and then initialise the new
> + * BAR state.
> + */
> +struct ef100_bar_config_ops {
> + int (*init)(struct efx_probe_data *probe_data);
> + void (*fini)(struct efx_probe_data *probe_data);
> +};
> +
> +static const struct ef100_bar_config_ops bar_config_ops[] = {
> + [EF100_BAR_CONFIG_EF100] = {
> + .init = ef100_probe_netdev,
> + .fini = ef100_remove_netdev
> + },
> +#ifdef CONFIG_SFC_VDPA
> + [EF100_BAR_CONFIG_VDPA] = {
> + .init = NULL,
> + .fini = NULL
> + },
> +#endif
> + [EF100_BAR_CONFIG_NONE] = {
> + .init = NULL,
> + .fini = NULL
> + },
> +};

This looks more like a mini bus implementation. I wonder if we can
reuse an auxiliary bus here which is more user friendly for management
tools. It might work like, during PCI probe, register an aux device
ef100_nic.net . Then we will have two drivers that could be bound:

1) netdev
2) vdpa

So the bar config setup could be delayed to the auxiliary driver
probe. And we can register the mgmt device during probing the vdpa aux
device. This complies with the sysfs based mgmt interface for driver
core and allows more policy to be added on top e.g autoprobe/override
etc.

Thanks


2023-03-10 05:06:18

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 08/14] sfc: implement vdpa vring config operations

On Tue, Mar 7, 2023 at 7:37 PM Gautam Dawar <[email protected]> wrote:
>
> This patch implements the vDPA config operations related to
> virtqueues or vrings. These include setting vring address,
> getting vq state, operations to enable/disable a vq etc.
> The resources required for vring operations eg. VI, interrupts etc.
> are also allocated.
>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/ef100_vdpa.c | 46 +++-
> drivers/net/ethernet/sfc/ef100_vdpa.h | 54 +++++
> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 275 ++++++++++++++++++++++
> 3 files changed, 374 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
> index 4c5a98c9d6c3..c66e5aef69ea 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
> @@ -14,6 +14,7 @@
> #include "ef100_vdpa.h"
> #include "mcdi_vdpa.h"
> #include "mcdi_filters.h"
> +#include "mcdi_functions.h"
> #include "ef100_netdev.h"
>
> static struct virtio_device_id ef100_vdpa_id_table[] = {
> @@ -47,12 +48,31 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data)
> return rc;
> }
>
> +static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)
> +{
> + /* The first VI is reserved for MCDI
> + * 1 VI each for rx + tx ring
> + */
> + unsigned int max_vis = 1 + EF100_VDPA_MAX_QUEUES_PAIRS;
> + unsigned int min_vis = 1 + 1;
> + int rc;
> +
> + rc = efx_mcdi_alloc_vis(efx, min_vis, max_vis,
> + NULL, allocated_vis);
> + if (!rc)
> + return rc;
> + if (*allocated_vis < min_vis)
> + return -ENOSPC;
> + return 0;
> +}
> +
> static void ef100_vdpa_delete(struct efx_nic *efx)
> {
> if (efx->vdpa_nic) {
> /* replace with _vdpa_unregister_device later */
> put_device(&efx->vdpa_nic->vdpa_dev.dev);
> }
> + efx_mcdi_free_vis(efx);
> }
>
> void ef100_vdpa_fini(struct efx_probe_data *probe_data)
> @@ -104,9 +124,19 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> {
> struct ef100_nic_data *nic_data = efx->nic_data;
> struct ef100_vdpa_nic *vdpa_nic;
> + unsigned int allocated_vis;
> int rc;
> + u8 i;
>
> nic_data->vdpa_class = dev_type;
> + rc = vdpa_allocate_vis(efx, &allocated_vis);
> + if (rc) {
> + pci_err(efx->pci_dev,
> + "%s Alloc VIs failed for vf:%u error:%d\n",
> + __func__, nic_data->vf_index, rc);
> + return ERR_PTR(rc);
> + }
> +
> vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
> vdpa_dev, &efx->pci_dev->dev,
> &ef100_vdpa_config_ops,
> @@ -117,7 +147,8 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> "vDPA device allocation failed for vf: %u\n",
> nic_data->vf_index);
> nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
> - return ERR_PTR(-ENOMEM);
> + rc = -ENOMEM;
> + goto err_alloc_vis_free;
> }
>
> mutex_init(&vdpa_nic->lock);
> @@ -125,11 +156,21 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
> vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
> vdpa_nic->efx = efx;
> + vdpa_nic->max_queue_pairs = allocated_vis - 1;
> vdpa_nic->pf_index = nic_data->pf_index;
> vdpa_nic->vf_index = nic_data->vf_index;
> vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
> vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;
>
> + for (i = 0; i < (2 * vdpa_nic->max_queue_pairs); i++) {
> + rc = ef100_vdpa_init_vring(vdpa_nic, i);
> + if (rc) {
> + pci_err(efx->pci_dev,
> + "vring init idx: %u failed, rc: %d\n", i, rc);
> + goto err_put_device;
> + }
> + }
> +
> rc = get_net_config(vdpa_nic);
> if (rc)
> goto err_put_device;
> @@ -146,6 +187,9 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> err_put_device:
> /* put_device invokes ef100_vdpa_free */
> put_device(&vdpa_nic->vdpa_dev.dev);
> +
> +err_alloc_vis_free:
> + efx_mcdi_free_vis(efx);
> return ERR_PTR(rc);
> }
>
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
> index dcf4a8156415..348ca8a7404b 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
> @@ -32,6 +32,21 @@
> /* Alignment requirement of the Virtqueue */
> #define EF100_VDPA_VQ_ALIGN 4096
>
> +/* Vring configuration definitions */
> +#define EF100_VRING_ADDRESS_CONFIGURED 0x1
> +#define EF100_VRING_SIZE_CONFIGURED 0x10
> +#define EF100_VRING_READY_CONFIGURED 0x100
> +#define EF100_VRING_CONFIGURED (EF100_VRING_ADDRESS_CONFIGURED | \
> + EF100_VRING_SIZE_CONFIGURED | \
> + EF100_VRING_READY_CONFIGURED)
> +#define EF100_VRING_CREATED 0x1000
> +
> +/* Maximum size of msix name */
> +#define EF100_VDPA_MAX_MSIX_NAME_SIZE 256
> +
> +/* Default high IOVA for MCDI buffer */
> +#define EF100_VDPA_IOVA_BASE_ADDR 0x20000000000
> +
> /**
> * enum ef100_vdpa_nic_state - possible states for a vDPA NIC
> *
> @@ -57,6 +72,41 @@ enum ef100_vdpa_vq_type {
> EF100_VDPA_VQ_NTYPES
> };
>
> +/**
> + * struct ef100_vdpa_vring_info - vDPA vring data structure
> + *
> + * @desc: Descriptor area address of the vring
> + * @avail: Available area address of the vring
> + * @used: Device area address of the vring
> + * @size: Number of entries in the vring
> + * @vring_state: bit map to track vring configuration
> + * @last_avail_idx: last available index of the vring
> + * @last_used_idx: last used index of the vring
> + * @doorbell_offset: doorbell offset
> + * @doorbell_offset_valid: true if @doorbell_offset is updated
> + * @vring_type: type of vring created
> + * @vring_ctx: vring context information
> + * @msix_name: device name for vring irq handler
> + * @irq: irq number for vring irq handler
> + * @cb: callback for vring interrupts
> + */
> +struct ef100_vdpa_vring_info {
> + dma_addr_t desc;
> + dma_addr_t avail;
> + dma_addr_t used;
> + u32 size;
> + u16 vring_state;
> + u32 last_avail_idx;
> + u32 last_used_idx;
> + u32 doorbell_offset;
> + bool doorbell_offset_valid;
> + enum ef100_vdpa_vq_type vring_type;
> + struct efx_vring_ctx *vring_ctx;
> + char msix_name[EF100_VDPA_MAX_MSIX_NAME_SIZE];
> + u32 irq;
> + struct vdpa_callback cb;
> +};
> +
> /**
> * struct ef100_vdpa_nic - vDPA NIC data structure
> *
> @@ -70,6 +120,7 @@ enum ef100_vdpa_vq_type {
> * @features: negotiated feature bits
> * @max_queue_pairs: maximum number of queue pairs supported
> * @net_config: virtio_net_config data
> + * @vring: vring information of the vDPA device.
> * @mac_address: mac address of interface associated with this vdpa device
> * @mac_configured: true after MAC address is configured
> * @cfg_cb: callback for config change
> @@ -86,6 +137,7 @@ struct ef100_vdpa_nic {
> u64 features;
> u32 max_queue_pairs;
> struct virtio_net_config net_config;
> + struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
> u8 *mac_address;
> bool mac_configured;
> struct vdpa_callback cfg_cb;
> @@ -95,6 +147,8 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data);
> void ef100_vdpa_fini(struct efx_probe_data *probe_data);
> int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
> void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
> +void ef100_vdpa_irq_vectors_free(void *data);
> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>
> static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
> {
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> index a2364ef9f492..0051c4c0e47c 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> @@ -9,13 +9,270 @@
>
> #include <linux/vdpa.h>
> #include "ef100_vdpa.h"
> +#include "io.h"
> #include "mcdi_vdpa.h"
>
> +/* Get the queue's function-local index of the associated VI
> + * virtqueue number queue 0 is reserved for MCDI
> + */
> +#define EFX_GET_VI_INDEX(vq_num) (((vq_num) / 2) + 1)
> +
> static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
> {
> return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
> }
>
> +void ef100_vdpa_irq_vectors_free(void *data)
> +{
> + pci_free_irq_vectors(data);
> +}
> +
> +static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + struct efx_vring_ctx *vring_ctx;
> + u32 vi_index;
> +
> + if (idx % 2) /* Even VQ for RX and odd for TX */
> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_TYPE_NET_TXQ;
> + else
> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_TYPE_NET_RXQ;
> + vi_index = EFX_GET_VI_INDEX(idx);
> + vring_ctx = efx_vdpa_vring_init(vdpa_nic->efx, vi_index,
> + vdpa_nic->vring[idx].vring_type);
> + if (IS_ERR(vring_ctx))
> + return PTR_ERR(vring_ctx);
> +
> + vdpa_nic->vring[idx].vring_ctx = vring_ctx;
> + return 0;
> +}
> +
> +static void delete_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + efx_vdpa_vring_fini(vdpa_nic->vring[idx].vring_ctx);
> + vdpa_nic->vring[idx].vring_ctx = NULL;
> +}
> +
> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
> + vdpa_nic->vring[idx].vring_state = 0;
> + vdpa_nic->vring[idx].last_avail_idx = 0;
> + vdpa_nic->vring[idx].last_used_idx = 0;
> +}
> +
> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + u32 offset;
> + int rc;
> +
> + vdpa_nic->vring[idx].irq = -EINVAL;
> + rc = create_vring_ctx(vdpa_nic, idx);
> + if (rc) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: create_vring_ctx failed, idx:%u, err:%d\n",
> + __func__, idx, rc);
> + return rc;
> + }
> +
> + rc = efx_vdpa_get_doorbell_offset(vdpa_nic->vring[idx].vring_ctx,
> + &offset);
> + if (rc) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: get_doorbell failed idx:%u, err:%d\n",
> + __func__, idx, rc);
> + goto err_get_doorbell_offset;
> + }
> + vdpa_nic->vring[idx].doorbell_offset = offset;
> + vdpa_nic->vring[idx].doorbell_offset_valid = true;
> +
> + return 0;
> +
> +err_get_doorbell_offset:
> + delete_vring_ctx(vdpa_nic, idx);
> + return rc;
> +}
> +
> +static bool is_qid_invalid(struct ef100_vdpa_nic *vdpa_nic, u16 idx,
> + const char *caller)
> +{
> + if (unlikely(idx >= (vdpa_nic->max_queue_pairs * 2))) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: Invalid qid %u\n", caller, idx);
> + return true;
> + }
> + return false;
> +}
> +
> +static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
> + u16 idx, u64 desc_area, u64 driver_area,
> + u64 device_area)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return -EINVAL;
> +
> + mutex_lock(&vdpa_nic->lock);
> + vdpa_nic->vring[idx].desc = desc_area;
> + vdpa_nic->vring[idx].avail = driver_area;
> + vdpa_nic->vring[idx].used = device_area;
> + vdpa_nic->vring[idx].vring_state |= EF100_VRING_ADDRESS_CONFIGURED;
> + mutex_unlock(&vdpa_nic->lock);
> + return 0;
> +}
> +
> +static void ef100_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return;
> +
> + if (!is_power_of_2(num)) {
> + dev_err(&vdev->dev, "%s: Index:%u size:%u not power of 2\n",
> + __func__, idx, num);
> + return;
> + }

Note that this is not a requirement for packed virtqueue.

"""
Queue Size corresponds to the maximum number of descriptors in the
virtqueue5. The Queue Size value does not have to be a power of 2.
"""

> + if (num > EF100_VDPA_VQ_NUM_MAX_SIZE) {
> + dev_err(&vdev->dev, "%s: Index:%u size:%u more than max:%u\n",
> + __func__, idx, num, EF100_VDPA_VQ_NUM_MAX_SIZE);
> + return;
> + }
> + mutex_lock(&vdpa_nic->lock);
> + vdpa_nic->vring[idx].size = num;
> + vdpa_nic->vring[idx].vring_state |= EF100_VRING_SIZE_CONFIGURED;
> + mutex_unlock(&vdpa_nic->lock);
> +}
> +
> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + u32 idx_val;
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return;
> +
> + if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
> + return;

In which case could we hit this condition?

> +
> + idx_val = idx;
> + _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
> + vdpa_nic->vring[idx].doorbell_offset);
> +}
> +
> +static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
> + struct vdpa_callback *cb)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return;
> +
> + if (cb)
> + vdpa_nic->vring[idx].cb = *cb;
> +}
> +
> +static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
> + bool ready)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return;
> +
> + mutex_lock(&vdpa_nic->lock);
> + if (ready) {
> + vdpa_nic->vring[idx].vring_state |=
> + EF100_VRING_READY_CONFIGURED;

I think it would be sufficient to have EF100_VRING_READY_CONFIGURED
here. With this set, the device can think the vq configuration is done
by the driver.

Or is there anything special for size and num?

Thanks


> + } else {
> + vdpa_nic->vring[idx].vring_state &=
> + ~EF100_VRING_READY_CONFIGURED;
> + }
> + mutex_unlock(&vdpa_nic->lock);
> +}
> +
> +static bool ef100_vdpa_get_vq_ready(struct vdpa_device *vdev, u16 idx)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + bool ready;
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return false;
> +
> + mutex_lock(&vdpa_nic->lock);
> + ready = vdpa_nic->vring[idx].vring_state & EF100_VRING_READY_CONFIGURED;
> + mutex_unlock(&vdpa_nic->lock);
> + return ready;
> +}
> +
> +static int ef100_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx,
> + const struct vdpa_vq_state *state)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return -EINVAL;
> +
> + mutex_lock(&vdpa_nic->lock);
> + vdpa_nic->vring[idx].last_avail_idx = state->split.avail_index;
> + vdpa_nic->vring[idx].last_used_idx = state->split.avail_index;
> + mutex_unlock(&vdpa_nic->lock);
> + return 0;
> +}
> +
> +static int ef100_vdpa_get_vq_state(struct vdpa_device *vdev,
> + u16 idx, struct vdpa_vq_state *state)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return -EINVAL;
> +
> + mutex_lock(&vdpa_nic->lock);
> + state->split.avail_index = (u16)vdpa_nic->vring[idx].last_used_idx;
> + mutex_unlock(&vdpa_nic->lock);
> +
> + return 0;
> +}
> +
> +static struct vdpa_notification_area
> + ef100_vdpa_get_vq_notification(struct vdpa_device *vdev,
> + u16 idx)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + struct vdpa_notification_area notify_area = {0, 0};
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + goto end;
> +
> + mutex_lock(&vdpa_nic->lock);
> + notify_area.addr = (uintptr_t)(vdpa_nic->efx->membase_phys +
> + vdpa_nic->vring[idx].doorbell_offset);
> + /* VDPA doorbells are at a stride of VI/2
> + * One VI stride is shared by both rx & tx doorbells
> + */
> + notify_area.size = vdpa_nic->efx->vi_stride / 2;
> + mutex_unlock(&vdpa_nic->lock);
> +
> +end:
> + return notify_area;
> +}
> +
> +static int ef100_get_vq_irq(struct vdpa_device *vdev, u16 idx)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + u32 irq;
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return -EINVAL;
> +
> + mutex_lock(&vdpa_nic->lock);
> + irq = vdpa_nic->vring[idx].irq;
> + mutex_unlock(&vdpa_nic->lock);
> +
> + return irq;
> +}
> +
> static u32 ef100_vdpa_get_vq_align(struct vdpa_device *vdev)
> {
> return EF100_VDPA_VQ_ALIGN;
> @@ -80,6 +337,8 @@ static void ef100_vdpa_set_config_cb(struct vdpa_device *vdev,
>
> if (cb)
> vdpa_nic->cfg_cb = *cb;
> + else
> + memset(&vdpa_nic->cfg_cb, 0, sizeof(vdpa_nic->cfg_cb));
> }
>
> static u16 ef100_vdpa_get_vq_num_max(struct vdpa_device *vdev)
> @@ -137,14 +396,30 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
> static void ef100_vdpa_free(struct vdpa_device *vdev)
> {
> struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + int i;
>
> if (vdpa_nic) {
> + for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
> + reset_vring(vdpa_nic, i);
> + if (vdpa_nic->vring[i].vring_ctx)
> + delete_vring_ctx(vdpa_nic, i);
> + }
> mutex_destroy(&vdpa_nic->lock);
> vdpa_nic->efx->vdpa_nic = NULL;
> }
> }
>
> const struct vdpa_config_ops ef100_vdpa_config_ops = {
> + .set_vq_address = ef100_vdpa_set_vq_address,
> + .set_vq_num = ef100_vdpa_set_vq_num,
> + .kick_vq = ef100_vdpa_kick_vq,
> + .set_vq_cb = ef100_vdpa_set_vq_cb,
> + .set_vq_ready = ef100_vdpa_set_vq_ready,
> + .get_vq_ready = ef100_vdpa_get_vq_ready,
> + .set_vq_state = ef100_vdpa_set_vq_state,
> + .get_vq_state = ef100_vdpa_get_vq_state,
> + .get_vq_notification = ef100_vdpa_get_vq_notification,
> + .get_vq_irq = ef100_get_vq_irq,
> .get_vq_align = ef100_vdpa_get_vq_align,
> .get_device_features = ef100_vdpa_get_device_features,
> .set_driver_features = ef100_vdpa_set_driver_features,
> --
> 2.30.1
>


2023-03-10 05:06:43

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 09/14] sfc: implement device status related vdpa config operations

On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]> wrote:
>
> vDPA config opertions to handle get/set device status and device
> reset have been implemented. Also .suspend config operation is
> implemented to support Live Migration.
>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/ef100_vdpa.c | 16 +-
> drivers/net/ethernet/sfc/ef100_vdpa.h | 2 +
> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 367 ++++++++++++++++++++--
> 3 files changed, 355 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
> index c66e5aef69ea..4ba57827a6cd 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
> @@ -68,9 +68,14 @@ static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)
>
> static void ef100_vdpa_delete(struct efx_nic *efx)
> {
> + struct vdpa_device *vdpa_dev;
> +
> if (efx->vdpa_nic) {
> + vdpa_dev = &efx->vdpa_nic->vdpa_dev;
> + ef100_vdpa_reset(vdpa_dev);
> +
> /* replace with _vdpa_unregister_device later */
> - put_device(&efx->vdpa_nic->vdpa_dev.dev);
> + put_device(&vdpa_dev->dev);
> }
> efx_mcdi_free_vis(efx);
> }
> @@ -171,6 +176,15 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> }
> }
>
> + rc = devm_add_action_or_reset(&efx->pci_dev->dev,
> + ef100_vdpa_irq_vectors_free,
> + efx->pci_dev);
> + if (rc) {
> + pci_err(efx->pci_dev,
> + "Failed adding devres for freeing irq vectors\n");
> + goto err_put_device;
> + }
> +
> rc = get_net_config(vdpa_nic);
> if (rc)
> goto err_put_device;
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
> index 348ca8a7404b..58791402e454 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
> @@ -149,6 +149,8 @@ int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
> void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
> void ef100_vdpa_irq_vectors_free(void *data);
> int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
> +void ef100_vdpa_irq_vectors_free(void *data);
> +int ef100_vdpa_reset(struct vdpa_device *vdev);
>
> static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
> {
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> index 0051c4c0e47c..95a2177f85a2 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> @@ -22,11 +22,6 @@ static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
> return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
> }
>
> -void ef100_vdpa_irq_vectors_free(void *data)
> -{
> - pci_free_irq_vectors(data);
> -}
> -
> static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> {
> struct efx_vring_ctx *vring_ctx;
> @@ -52,14 +47,6 @@ static void delete_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> vdpa_nic->vring[idx].vring_ctx = NULL;
> }
>
> -static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> -{
> - vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
> - vdpa_nic->vring[idx].vring_state = 0;
> - vdpa_nic->vring[idx].last_avail_idx = 0;
> - vdpa_nic->vring[idx].last_used_idx = 0;
> -}
> -
> int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> {
> u32 offset;
> @@ -103,6 +90,236 @@ static bool is_qid_invalid(struct ef100_vdpa_nic *vdpa_nic, u16 idx,
> return false;
> }
>
> +static void irq_vring_fini(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
> + struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
> +
> + devm_free_irq(&pci_dev->dev, vring->irq, vring);
> + vring->irq = -EINVAL;
> +}
> +
> +static irqreturn_t vring_intr_handler(int irq, void *arg)
> +{
> + struct ef100_vdpa_vring_info *vring = arg;
> +
> + if (vring->cb.callback)
> + return vring->cb.callback(vring->cb.private);
> +
> + return IRQ_NONE;
> +}
> +
> +static int ef100_vdpa_irq_vectors_alloc(struct pci_dev *pci_dev, u16 nvqs)
> +{
> + int rc;
> +
> + rc = pci_alloc_irq_vectors(pci_dev, nvqs, nvqs, PCI_IRQ_MSIX);
> + if (rc < 0)
> + pci_err(pci_dev,
> + "Failed to alloc %d IRQ vectors, err:%d\n", nvqs, rc);
> + return rc;
> +}
> +
> +void ef100_vdpa_irq_vectors_free(void *data)
> +{
> + pci_free_irq_vectors(data);
> +}
> +
> +static int irq_vring_init(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
> + struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
> + int irq;
> + int rc;
> +
> + snprintf(vring->msix_name, 256, "x_vdpa[%s]-%d\n",
> + pci_name(pci_dev), idx);
> + irq = pci_irq_vector(pci_dev, idx);
> + rc = devm_request_irq(&pci_dev->dev, irq, vring_intr_handler, 0,
> + vring->msix_name, vring);
> + if (rc)
> + pci_err(pci_dev,
> + "devm_request_irq failed for vring %d, rc %d\n",
> + idx, rc);
> + else
> + vring->irq = irq;
> +
> + return rc;
> +}
> +
> +static int delete_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + struct efx_vring_dyn_cfg vring_dyn_cfg;
> + int rc;
> +
> + if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
> + return 0;
> +
> + rc = efx_vdpa_vring_destroy(vdpa_nic->vring[idx].vring_ctx,
> + &vring_dyn_cfg);
> + if (rc)
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: delete vring failed index:%u, err:%d\n",
> + __func__, idx, rc);
> + vdpa_nic->vring[idx].last_avail_idx = vring_dyn_cfg.avail_idx;
> + vdpa_nic->vring[idx].last_used_idx = vring_dyn_cfg.used_idx;
> + vdpa_nic->vring[idx].vring_state &= ~EF100_VRING_CREATED;
> +
> + irq_vring_fini(vdpa_nic, idx);
> +
> + return rc;
> +}
> +
> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + u32 idx_val;
> +
> + if (is_qid_invalid(vdpa_nic, idx, __func__))
> + return;
> +
> + if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
> + return;
> +
> + idx_val = idx;
> + _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
> + vdpa_nic->vring[idx].doorbell_offset);
> +}
> +
> +static bool can_create_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + if (vdpa_nic->vring[idx].vring_state == EF100_VRING_CONFIGURED &&
> + vdpa_nic->status & VIRTIO_CONFIG_S_DRIVER_OK &&
> + !(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
> + return true;
> +
> + return false;
> +}
> +
> +static int create_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + struct efx_vring_dyn_cfg vring_dyn_cfg;
> + struct efx_vring_cfg vring_cfg;
> + int rc;
> +
> + rc = irq_vring_init(vdpa_nic, idx);
> + if (rc) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: irq_vring_init failed. index:%u, err:%d\n",
> + __func__, idx, rc);
> + return rc;
> + }
> + vring_cfg.desc = vdpa_nic->vring[idx].desc;
> + vring_cfg.avail = vdpa_nic->vring[idx].avail;
> + vring_cfg.used = vdpa_nic->vring[idx].used;
> + vring_cfg.size = vdpa_nic->vring[idx].size;
> + vring_cfg.features = vdpa_nic->features;
> + vring_cfg.msix_vector = idx;
> + vring_dyn_cfg.avail_idx = vdpa_nic->vring[idx].last_avail_idx;
> + vring_dyn_cfg.used_idx = vdpa_nic->vring[idx].last_used_idx;
> +
> + rc = efx_vdpa_vring_create(vdpa_nic->vring[idx].vring_ctx,
> + &vring_cfg, &vring_dyn_cfg);
> + if (rc) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: vring_create failed index:%u, err:%d\n",
> + __func__, idx, rc);
> + goto err_vring_create;
> + }
> + vdpa_nic->vring[idx].vring_state |= EF100_VRING_CREATED;
> +
> + /* A VQ kick allows the device to read the avail_idx, which will be
> + * required at the destination after live migration.
> + */
> + ef100_vdpa_kick_vq(&vdpa_nic->vdpa_dev, idx);
> +
> + return 0;
> +
> +err_vring_create:
> + irq_vring_fini(vdpa_nic, idx);
> + return rc;
> +}
> +
> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
> +{
> + delete_vring(vdpa_nic, idx);
> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
> + vdpa_nic->vring[idx].vring_state = 0;
> + vdpa_nic->vring[idx].last_avail_idx = 0;
> + vdpa_nic->vring[idx].last_used_idx = 0;
> +}
> +
> +static void ef100_reset_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
> +{
> + int i;
> +
> + WARN_ON(!mutex_is_locked(&vdpa_nic->lock));
> +
> + if (!vdpa_nic->status)
> + return;
> +
> + vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
> + vdpa_nic->status = 0;
> + vdpa_nic->features = 0;
> + for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++)
> + reset_vring(vdpa_nic, i);
> + ef100_vdpa_irq_vectors_free(vdpa_nic->efx->pci_dev);
> +}
> +
> +/* May be called under the rtnl lock */
> +int ef100_vdpa_reset(struct vdpa_device *vdev)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> +
> + /* vdpa device can be deleted anytime but the bar_config
> + * could still be vdpa and hence efx->state would be STATE_VDPA.
> + * Accordingly, ensure vdpa device exists before reset handling
> + */
> + if (!vdpa_nic)
> + return -ENODEV;
> +
> + mutex_lock(&vdpa_nic->lock);
> + ef100_reset_vdpa_device(vdpa_nic);
> + mutex_unlock(&vdpa_nic->lock);
> + return 0;
> +}
> +
> +static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
> +{
> + struct efx_nic *efx = vdpa_nic->efx;
> + struct ef100_nic_data *nic_data;
> + int i, j;
> + int rc;
> +
> + nic_data = efx->nic_data;
> + rc = ef100_vdpa_irq_vectors_alloc(efx->pci_dev,
> + vdpa_nic->max_queue_pairs * 2);
> + if (rc < 0) {
> + pci_err(efx->pci_dev,
> + "vDPA IRQ alloc failed for vf: %u err:%d\n",
> + nic_data->vf_index, rc);
> + return rc;
> + }
> +
> + for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
> + if (can_create_vring(vdpa_nic, i)) {
> + rc = create_vring(vdpa_nic, i);
> + if (rc)
> + goto clear_vring;
> + }
> + }
> +
> + vdpa_nic->vdpa_state = EF100_VDPA_STATE_STARTED;

It looks to me that this duplicates with the DRIVER_OK status bit.

> + return 0;
> +
> +clear_vring:
> + for (j = 0; j < i; j++)
> + delete_vring(vdpa_nic, j);
> +
> + ef100_vdpa_irq_vectors_free(efx->pci_dev);
> + return rc;
> +}
> +
> static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
> u16 idx, u64 desc_area, u64 driver_area,
> u64 device_area)
> @@ -144,22 +361,6 @@ static void ef100_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
> mutex_unlock(&vdpa_nic->lock);
> }
>
> -static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
> -{
> - struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> - u32 idx_val;
> -
> - if (is_qid_invalid(vdpa_nic, idx, __func__))
> - return;
> -
> - if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
> - return;
> -
> - idx_val = idx;
> - _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
> - vdpa_nic->vring[idx].doorbell_offset);
> -}
> -
> static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
> struct vdpa_callback *cb)
> {
> @@ -176,6 +377,7 @@ static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
> bool ready)
> {
> struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + int rc;
>
> if (is_qid_invalid(vdpa_nic, idx, __func__))
> return;
> @@ -184,9 +386,21 @@ static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
> if (ready) {
> vdpa_nic->vring[idx].vring_state |=
> EF100_VRING_READY_CONFIGURED;
> + if (vdpa_nic->vdpa_state == EF100_VDPA_STATE_STARTED &&
> + can_create_vring(vdpa_nic, idx)) {
> + rc = create_vring(vdpa_nic, idx);
> + if (rc)
> + /* Rollback ready configuration
> + * So that the above layer driver
> + * can make another attempt to set ready
> + */
> + vdpa_nic->vring[idx].vring_state &=
> + ~EF100_VRING_READY_CONFIGURED;
> + }
> } else {
> vdpa_nic->vring[idx].vring_state &=
> ~EF100_VRING_READY_CONFIGURED;
> + delete_vring(vdpa_nic, idx);
> }
> mutex_unlock(&vdpa_nic->lock);
> }
> @@ -296,6 +510,12 @@ static u64 ef100_vdpa_get_device_features(struct vdpa_device *vdev)
> }
>
> features |= BIT_ULL(VIRTIO_NET_F_MAC);
> + /* As QEMU SVQ doesn't implement the following features,
> + * masking them off to allow Live Migration
> + */
> + features &= ~BIT_ULL(VIRTIO_F_IN_ORDER);
> + features &= ~BIT_ULL(VIRTIO_F_ORDER_PLATFORM);

It's better not to work around userspace bugs in the kernel. We should
fix Qemu instead.

> +
> return features;
> }
>
> @@ -356,6 +576,77 @@ static u32 ef100_vdpa_get_vendor_id(struct vdpa_device *vdev)
> return EF100_VDPA_VENDOR_ID;
> }
>
> +static u8 ef100_vdpa_get_status(struct vdpa_device *vdev)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + u8 status;
> +
> + mutex_lock(&vdpa_nic->lock);
> + status = vdpa_nic->status;
> + mutex_unlock(&vdpa_nic->lock);
> + return status;
> +}
> +
> +static void ef100_vdpa_set_status(struct vdpa_device *vdev, u8 status)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + u8 new_status;
> + int rc;
> +
> + mutex_lock(&vdpa_nic->lock);
> + if (!status) {
> + dev_info(&vdev->dev,
> + "%s: Status received is 0. Device reset being done\n",
> + __func__);

This is trigger-able by the userspace. It might be better to use
dev_dbg() instead.

> + ef100_reset_vdpa_device(vdpa_nic);
> + goto unlock_return;
> + }
> + new_status = status & ~vdpa_nic->status;
> + if (new_status == 0) {
> + dev_info(&vdev->dev,
> + "%s: New status same as current status\n", __func__);

Same here.

> + goto unlock_return;
> + }
> + if (new_status & VIRTIO_CONFIG_S_FAILED) {
> + ef100_reset_vdpa_device(vdpa_nic);
> + goto unlock_return;
> + }
> +
> + if (new_status & VIRTIO_CONFIG_S_ACKNOWLEDGE) {
> + vdpa_nic->status |= VIRTIO_CONFIG_S_ACKNOWLEDGE;
> + new_status &= ~VIRTIO_CONFIG_S_ACKNOWLEDGE;
> + }
> + if (new_status & VIRTIO_CONFIG_S_DRIVER) {
> + vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER;
> + new_status &= ~VIRTIO_CONFIG_S_DRIVER;
> + }
> + if (new_status & VIRTIO_CONFIG_S_FEATURES_OK) {
> + vdpa_nic->status |= VIRTIO_CONFIG_S_FEATURES_OK;
> + vdpa_nic->vdpa_state = EF100_VDPA_STATE_NEGOTIATED;

It might be better to explain the reason we need to track another
state in vdpa_state instead of simply using the device status.

> + new_status &= ~VIRTIO_CONFIG_S_FEATURES_OK;
> + }
> + if (new_status & VIRTIO_CONFIG_S_DRIVER_OK &&
> + vdpa_nic->vdpa_state == EF100_VDPA_STATE_NEGOTIATED) {
> + vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER_OK;
> + rc = start_vdpa_device(vdpa_nic);
> + if (rc) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: vDPA device failed:%d\n", __func__, rc);
> + vdpa_nic->status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
> + goto unlock_return;
> + }
> + new_status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
> + }
> + if (new_status) {
> + dev_warn(&vdev->dev,
> + "%s: Mismatch Status: %x & State: %u\n",
> + __func__, new_status, vdpa_nic->vdpa_state);
> + }
> +
> +unlock_return:
> + mutex_unlock(&vdpa_nic->lock);
> +}
> +
> static size_t ef100_vdpa_get_config_size(struct vdpa_device *vdev)
> {
> return sizeof(struct virtio_net_config);
> @@ -393,6 +684,20 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
> vdpa_nic->mac_configured = true;
> }
>
> +static int ef100_vdpa_suspend(struct vdpa_device *vdev)
> +{
> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + int i, rc;
> +
> + mutex_lock(&vdpa_nic->lock);
> + for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
> + rc = delete_vring(vdpa_nic, i);

Note that the suspension matters for the whole device. It means the
config space should not be changed. But the code here only suspends
the vring, is this intended?

Reset may have the same issue.

Thanks


> + if (rc)
> + break;
> + }
> + mutex_unlock(&vdpa_nic->lock);
> + return rc;
> +}
> static void ef100_vdpa_free(struct vdpa_device *vdev)
> {
> struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> @@ -428,9 +733,13 @@ const struct vdpa_config_ops ef100_vdpa_config_ops = {
> .get_vq_num_max = ef100_vdpa_get_vq_num_max,
> .get_device_id = ef100_vdpa_get_device_id,
> .get_vendor_id = ef100_vdpa_get_vendor_id,
> + .get_status = ef100_vdpa_get_status,
> + .set_status = ef100_vdpa_set_status,
> + .reset = ef100_vdpa_reset,
> .get_config_size = ef100_vdpa_get_config_size,
> .get_config = ef100_vdpa_get_config,
> .set_config = ef100_vdpa_set_config,
> .get_generation = NULL,
> + .suspend = ef100_vdpa_suspend,
> .free = ef100_vdpa_free,
> };
> --
> 2.30.1
>


2023-03-10 05:07:11

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 10/14] sfc: implement filters for receiving traffic

On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]> wrote:
>
> Implement unicast, broadcast and unknown multicast
> filters for receiving different types of traffic.
>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/ef100_vdpa.c | 157 ++++++++++++++++++++++
> drivers/net/ethernet/sfc/ef100_vdpa.h | 36 ++++-
> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 17 ++-
> 3 files changed, 207 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
> index 4ba57827a6cd..5c9f29f881a6 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
> @@ -16,12 +16,166 @@
> #include "mcdi_filters.h"
> #include "mcdi_functions.h"
> #include "ef100_netdev.h"
> +#include "filter.h"
> +#include "efx.h"
>
> +#define EFX_INVALID_FILTER_ID -1
> +
> +/* vDPA queues starts from 2nd VI or qid 1 */
> +#define EF100_VDPA_BASE_RX_QID 1
> +
> +static const char * const filter_names[] = { "bcast", "ucast", "mcast" };
> static struct virtio_device_id ef100_vdpa_id_table[] = {
> { .device = VIRTIO_ID_NET, .vendor = PCI_VENDOR_ID_REDHAT_QUMRANET },
> { 0 },
> };
>
> +static int ef100_vdpa_set_mac_filter(struct efx_nic *efx,
> + struct efx_filter_spec *spec,
> + u32 qid, u8 *mac_addr)
> +{
> + int rc;
> +
> + efx_filter_init_rx(spec, EFX_FILTER_PRI_AUTO, 0, qid);
> +
> + if (mac_addr) {
> + rc = efx_filter_set_eth_local(spec, EFX_FILTER_VID_UNSPEC,
> + mac_addr);
> + if (rc)
> + pci_err(efx->pci_dev,
> + "Filter set eth local failed, err: %d\n", rc);
> + } else {
> + efx_filter_set_mc_def(spec);
> + }
> +
> + rc = efx_filter_insert_filter(efx, spec, true);
> + if (rc < 0)
> + pci_err(efx->pci_dev,
> + "Filter insert failed, err: %d\n", rc);
> +
> + return rc;
> +}
> +
> +static int ef100_vdpa_delete_filter(struct ef100_vdpa_nic *vdpa_nic,
> + enum ef100_vdpa_mac_filter_type type)
> +{
> + struct vdpa_device *vdev = &vdpa_nic->vdpa_dev;
> + int rc;
> +
> + if (vdpa_nic->filters[type].filter_id == EFX_INVALID_FILTER_ID)
> + return rc;
> +
> + rc = efx_filter_remove_id_safe(vdpa_nic->efx,
> + EFX_FILTER_PRI_AUTO,
> + vdpa_nic->filters[type].filter_id);
> + if (rc) {
> + dev_err(&vdev->dev, "%s filter id: %d remove failed, err: %d\n",
> + filter_names[type], vdpa_nic->filters[type].filter_id,
> + rc);
> + } else {
> + vdpa_nic->filters[type].filter_id = EFX_INVALID_FILTER_ID;
> + vdpa_nic->filter_cnt--;
> + }
> + return rc;
> +}
> +
> +int ef100_vdpa_add_filter(struct ef100_vdpa_nic *vdpa_nic,
> + enum ef100_vdpa_mac_filter_type type)
> +{
> + struct vdpa_device *vdev = &vdpa_nic->vdpa_dev;
> + struct efx_nic *efx = vdpa_nic->efx;
> + /* Configure filter on base Rx queue only */
> + u32 qid = EF100_VDPA_BASE_RX_QID;
> + struct efx_filter_spec *spec;
> + u8 baddr[ETH_ALEN];
> + int rc;
> +
> + /* remove existing filter */
> + rc = ef100_vdpa_delete_filter(vdpa_nic, type);
> + if (rc < 0) {
> + dev_err(&vdev->dev, "%s MAC filter deletion failed, err: %d",
> + filter_names[type], rc);
> + return rc;
> + }
> +
> + /* Configure MAC Filter */
> + spec = &vdpa_nic->filters[type].spec;
> + if (type == EF100_VDPA_BCAST_MAC_FILTER) {
> + eth_broadcast_addr(baddr);
> + rc = ef100_vdpa_set_mac_filter(efx, spec, qid, baddr);
> + } else if (type == EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER) {
> + rc = ef100_vdpa_set_mac_filter(efx, spec, qid, NULL);
> + } else {
> + /* Ensure we have a valid mac address */
> + if (!vdpa_nic->mac_configured ||
> + !is_valid_ether_addr(vdpa_nic->mac_address))
> + return -EINVAL;
> +
> + rc = ef100_vdpa_set_mac_filter(efx, spec, qid,
> + vdpa_nic->mac_address);
> + }
> +
> + if (rc >= 0) {
> + vdpa_nic->filters[type].filter_id = rc;
> + vdpa_nic->filter_cnt++;
> +
> + return 0;
> + }
> +
> + dev_err(&vdev->dev, "%s MAC filter insert failed, err: %d\n",
> + filter_names[type], rc);
> +
> + if (type != EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER) {
> + ef100_vdpa_filter_remove(vdpa_nic);
> + return rc;
> + }
> +
> + return 0;
> +}
> +
> +int ef100_vdpa_filter_remove(struct ef100_vdpa_nic *vdpa_nic)
> +{
> + enum ef100_vdpa_mac_filter_type filter;
> + int err = 0;
> + int rc;
> +
> + for (filter = EF100_VDPA_BCAST_MAC_FILTER;
> + filter <= EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER; filter++) {
> + rc = ef100_vdpa_delete_filter(vdpa_nic, filter);
> + if (rc < 0)
> + /* store status of last failed filter remove */
> + err = rc;
> + }
> + return err;
> +}
> +
> +int ef100_vdpa_filter_configure(struct ef100_vdpa_nic *vdpa_nic)
> +{
> + struct vdpa_device *vdev = &vdpa_nic->vdpa_dev;
> + enum ef100_vdpa_mac_filter_type filter;
> + int rc;
> +
> + /* remove existing filters, if any */
> + rc = ef100_vdpa_filter_remove(vdpa_nic);
> + if (rc < 0) {
> + dev_err(&vdev->dev,
> + "MAC filter deletion failed, err: %d", rc);
> + goto fail;
> + }
> +
> + for (filter = EF100_VDPA_BCAST_MAC_FILTER;
> + filter <= EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER; filter++) {
> + if (filter == EF100_VDPA_UCAST_MAC_FILTER &&
> + !vdpa_nic->mac_configured)
> + continue;

Nit: is this better to move this inside ef100_vdpa_add_filter()?

> + rc = ef100_vdpa_add_filter(vdpa_nic, filter);
> + if (rc < 0)
> + goto fail;
> + }
> +fail:
> + return rc;
> +}
> +
> int ef100_vdpa_init(struct efx_probe_data *probe_data)
> {
> struct efx_nic *efx = &probe_data->efx;
> @@ -185,6 +339,9 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> goto err_put_device;
> }
>
> + for (i = 0; i < EF100_VDPA_MAC_FILTER_NTYPES; i++)
> + vdpa_nic->filters[i].filter_id = EFX_INVALID_FILTER_ID;
> +
> rc = get_net_config(vdpa_nic);
> if (rc)
> goto err_put_device;
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
> index 58791402e454..49fb6be04eb3 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
> @@ -72,6 +72,22 @@ enum ef100_vdpa_vq_type {
> EF100_VDPA_VQ_NTYPES
> };
>
> +/**
> + * enum ef100_vdpa_mac_filter_type - vdpa filter types
> + *
> + * @EF100_VDPA_BCAST_MAC_FILTER: Broadcast MAC filter
> + * @EF100_VDPA_UCAST_MAC_FILTER: Unicast MAC filter
> + * @EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER: Unknown multicast MAC filter to allow
> + * IPv6 Neighbor Solicitation Message
> + * @EF100_VDPA_MAC_FILTER_NTYPES: Number of vDPA filter types
> + */
> +enum ef100_vdpa_mac_filter_type {
> + EF100_VDPA_BCAST_MAC_FILTER,
> + EF100_VDPA_UCAST_MAC_FILTER,
> + EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER,
> + EF100_VDPA_MAC_FILTER_NTYPES,
> +};
> +
> /**
> * struct ef100_vdpa_vring_info - vDPA vring data structure
> *
> @@ -107,6 +123,17 @@ struct ef100_vdpa_vring_info {
> struct vdpa_callback cb;
> };
>
> +/**
> + * struct ef100_vdpa_filter - vDPA filter data structure
> + *
> + * @filter_id: filter id of this filter
> + * @efx_filter_spec: hardware filter specs for this vdpa device
> + */
> +struct ef100_vdpa_filter {
> + s32 filter_id;
> + struct efx_filter_spec spec;
> +};
> +
> /**
> * struct ef100_vdpa_nic - vDPA NIC data structure
> *
> @@ -116,6 +143,7 @@ struct ef100_vdpa_vring_info {
> * @lock: Managing access to vdpa config operations
> * @pf_index: PF index of the vDPA VF
> * @vf_index: VF index of the vDPA VF
> + * @filter_cnt: total number of filters created on this vdpa device
> * @status: device status as per VIRTIO spec
> * @features: negotiated feature bits
> * @max_queue_pairs: maximum number of queue pairs supported
> @@ -123,6 +151,7 @@ struct ef100_vdpa_vring_info {
> * @vring: vring information of the vDPA device.
> * @mac_address: mac address of interface associated with this vdpa device
> * @mac_configured: true after MAC address is configured
> + * @filters: details of all filters created on this vdpa device
> * @cfg_cb: callback for config change
> */
> struct ef100_vdpa_nic {
> @@ -133,6 +162,7 @@ struct ef100_vdpa_nic {
> struct mutex lock;
> u32 pf_index;
> u32 vf_index;
> + u32 filter_cnt;
> u8 status;
> u64 features;
> u32 max_queue_pairs;
> @@ -140,6 +170,7 @@ struct ef100_vdpa_nic {
> struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
> u8 *mac_address;
> bool mac_configured;
> + struct ef100_vdpa_filter filters[EF100_VDPA_MAC_FILTER_NTYPES];
> struct vdpa_callback cfg_cb;
> };
>
> @@ -147,7 +178,10 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data);
> void ef100_vdpa_fini(struct efx_probe_data *probe_data);
> int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
> void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
> -void ef100_vdpa_irq_vectors_free(void *data);
> +int ef100_vdpa_filter_configure(struct ef100_vdpa_nic *vdpa_nic);
> +int ef100_vdpa_filter_remove(struct ef100_vdpa_nic *vdpa_nic);
> +int ef100_vdpa_add_filter(struct ef100_vdpa_nic *vdpa_nic,
> + enum ef100_vdpa_mac_filter_type type);
> int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
> void ef100_vdpa_irq_vectors_free(void *data);
> int ef100_vdpa_reset(struct vdpa_device *vdev);
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> index 95a2177f85a2..db86c2693950 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> @@ -261,6 +261,7 @@ static void ef100_reset_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
> vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
> vdpa_nic->status = 0;
> vdpa_nic->features = 0;
> + ef100_vdpa_filter_remove(vdpa_nic);
> for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++)
> reset_vring(vdpa_nic, i);
> ef100_vdpa_irq_vectors_free(vdpa_nic->efx->pci_dev);
> @@ -295,7 +296,7 @@ static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
> rc = ef100_vdpa_irq_vectors_alloc(efx->pci_dev,
> vdpa_nic->max_queue_pairs * 2);
> if (rc < 0) {
> - pci_err(efx->pci_dev,
> + dev_err(&vdpa_nic->vdpa_dev.dev,

This should be done in the previous patch.

Thanks


> "vDPA IRQ alloc failed for vf: %u err:%d\n",
> nic_data->vf_index, rc);
> return rc;
> @@ -309,9 +310,19 @@ static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
> }
> }
>
> + rc = ef100_vdpa_filter_configure(vdpa_nic);
> + if (rc < 0) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: vdpa configure filter failed, err: %d\n",
> + __func__, rc);
> + goto err_filter_configure;
> + }
> +
> vdpa_nic->vdpa_state = EF100_VDPA_STATE_STARTED;
> return 0;
>
> +err_filter_configure:
> + ef100_vdpa_filter_remove(vdpa_nic);
> clear_vring:
> for (j = 0; j < i; j++)
> delete_vring(vdpa_nic, j);
> @@ -680,8 +691,10 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
> }
>
> memcpy((u8 *)&vdpa_nic->net_config + offset, buf, len);
> - if (is_valid_ether_addr(vdpa_nic->mac_address))
> + if (is_valid_ether_addr(vdpa_nic->mac_address)) {
> vdpa_nic->mac_configured = true;
> + ef100_vdpa_add_filter(vdpa_nic, EF100_VDPA_UCAST_MAC_FILTER);
> + }
> }
>
> static int ef100_vdpa_suspend(struct vdpa_device *vdev)
> --
> 2.30.1
>


2023-03-10 05:07:47

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 11/14] sfc: use PF's IOMMU domain for running VF's MCDI commands

On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]> wrote:
>
> This changeset uses MC_CMD_CLIENT_CMD to execute VF's MCDI
> commands when running in vDPA mode (STATE_VDPA).
> Also, use the PF's IOMMU domain for executing the encapsulated
> VF's MCDI commands to isolate DMA of guest buffers in the VF's
> IOMMU domain.
> This patch also updates the PCIe FN's client id in the efx_nic
> structure which is required while running MC_CMD_CLIENT_CMD.
>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/ef100.c | 1 +
> drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++
> drivers/net/ethernet/sfc/mcdi.c | 108 ++++++++++++++++++++++----
> drivers/net/ethernet/sfc/mcdi.h | 2 +-
> drivers/net/ethernet/sfc/net_driver.h | 2 +
> drivers/net/ethernet/sfc/ptp.c | 4 +-
> 6 files changed, 132 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
> index c1c69783db7b..8453c9ba0f41 100644
> --- a/drivers/net/ethernet/sfc/ef100.c
> +++ b/drivers/net/ethernet/sfc/ef100.c
> @@ -465,6 +465,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
> efx->type = (const struct efx_nic_type *)entry->driver_data;
>
> efx->pci_dev = pci_dev;
> + efx->client_id = MC_CMD_CLIENT_ID_SELF;
> pci_set_drvdata(pci_dev, efx);
> rc = efx_init_struct(efx, pci_dev);
> if (rc)
> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> index bda4fcbe1126..cd9f724a9e64 100644
> --- a/drivers/net/ethernet/sfc/ef100_nic.c
> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> @@ -206,9 +206,11 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
> "firmware reports num_mac_stats = %u\n",
> efx->num_mac_stats);
>
> +#ifdef CONFIG_SFC_VDPA
> nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
> CLIENT_CMD_VF_PROXY) &&
> efx->type->is_vf;
> +#endif

This should be done at patch 4?

> return 0;
> }
>
> @@ -1086,6 +1088,35 @@ static int ef100_check_design_params(struct efx_nic *efx)
> return rc;
> }
>
> +static int efx_ef100_update_client_id(struct efx_nic *efx)
> +{
> + struct ef100_nic_data *nic_data = efx->nic_data;
> + unsigned int pf_index = PCIE_FUNCTION_PF_NULL;
> + unsigned int vf_index = PCIE_FUNCTION_VF_NULL;
> + efx_qword_t pciefn;
> + int rc;
> +
> + if (efx->pci_dev->is_virtfn)
> + vf_index = nic_data->vf_index;
> + else
> + pf_index = nic_data->pf_index;
> +
> + /* Construct PCIE_FUNCTION structure */
> + EFX_POPULATE_QWORD_3(pciefn,
> + PCIE_FUNCTION_PF, pf_index,
> + PCIE_FUNCTION_VF, vf_index,
> + PCIE_FUNCTION_INTF, PCIE_INTERFACE_CALLER);
> + /* look up self client ID */
> + rc = efx_ef100_lookup_client_id(efx, pciefn, &efx->client_id);
> + if (rc) {
> + pci_warn(efx->pci_dev,
> + "%s: Failed to get client ID, rc %d\n",
> + __func__, rc);
> + }
> +
> + return rc;
> +}
> +
> /* NIC probe and remove
> */
> static int ef100_probe_main(struct efx_nic *efx)
> @@ -1173,6 +1204,10 @@ static int ef100_probe_main(struct efx_nic *efx)
> goto fail;
> efx->port_num = rc;
>
> + rc = efx_ef100_update_client_id(efx);
> + if (rc)
> + goto fail;
> +
> efx_mcdi_print_fwver(efx, fw_version, sizeof(fw_version));
> pci_dbg(efx->pci_dev, "Firmware version %s\n", fw_version);
>
> diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
> index a7f2c31071e8..3bf1ebe05775 100644
> --- a/drivers/net/ethernet/sfc/mcdi.c
> +++ b/drivers/net/ethernet/sfc/mcdi.c
> @@ -145,14 +145,15 @@ void efx_mcdi_fini(struct efx_nic *efx)
> kfree(efx->mcdi);
> }
>
> -static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
> - const efx_dword_t *inbuf, size_t inlen)
> +static void efx_mcdi_send_request(struct efx_nic *efx, u32 client_id,
> + unsigned int cmd, const efx_dword_t *inbuf,
> + size_t inlen)
> {
> struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
> #ifdef CONFIG_SFC_MCDI_LOGGING
> char *buf = mcdi->logging_buffer; /* page-sized */
> #endif
> - efx_dword_t hdr[2];
> + efx_dword_t hdr[5];
> size_t hdr_len;
> u32 xflags, seqno;
>
> @@ -179,7 +180,7 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
> MCDI_HEADER_XFLAGS, xflags,
> MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
> hdr_len = 4;
> - } else {
> + } else if (client_id == efx->client_id) {
> /* MCDI v2 */
> BUG_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
> EFX_POPULATE_DWORD_7(hdr[0],
> @@ -194,6 +195,35 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
> MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
> MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
> hdr_len = 8;
> + } else {
> + /* MCDI v2 */

Just wonder if V2 is a must for vDPA? If yes we probably need to fail
vDPA creation without it.

Thanks


> + WARN_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
> + /* MCDI v2 with credentials of a different client */
> + BUILD_BUG_ON(MC_CMD_CLIENT_CMD_IN_LEN != 4);
> + /* Outer CLIENT_CMD wrapper command with client ID */
> + EFX_POPULATE_DWORD_7(hdr[0],
> + MCDI_HEADER_RESPONSE, 0,
> + MCDI_HEADER_RESYNC, 1,
> + MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
> + MCDI_HEADER_DATALEN, 0,
> + MCDI_HEADER_SEQ, seqno,
> + MCDI_HEADER_XFLAGS, xflags,
> + MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
> + EFX_POPULATE_DWORD_2(hdr[1],
> + MC_CMD_V2_EXTN_IN_EXTENDED_CMD,
> + MC_CMD_CLIENT_CMD,
> + MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen + 12);
> + MCDI_SET_DWORD(&hdr[2],
> + CLIENT_CMD_IN_CLIENT_ID, client_id);
> +
> + /* MCDIv2 header for inner command */
> + EFX_POPULATE_DWORD_2(hdr[3],
> + MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
> + MCDI_HEADER_DATALEN, 0);
> + EFX_POPULATE_DWORD_2(hdr[4],
> + MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
> + MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
> + hdr_len = 20;
> }
>
> #ifdef CONFIG_SFC_MCDI_LOGGING
> @@ -474,7 +504,8 @@ static void efx_mcdi_release(struct efx_mcdi_iface *mcdi)
> &mcdi->async_list, struct efx_mcdi_async_param, list);
> if (async) {
> mcdi->state = MCDI_STATE_RUNNING_ASYNC;
> - efx_mcdi_send_request(efx, async->cmd,
> + efx_mcdi_send_request(efx, efx->client_id,
> + async->cmd,
> (const efx_dword_t *)(async + 1),
> async->inlen);
> mod_timer(&mcdi->async_timer,
> @@ -797,7 +828,7 @@ static int efx_mcdi_proxy_wait(struct efx_nic *efx, u32 handle, bool quiet)
> return mcdi->proxy_rx_status;
> }
>
> -static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
> +static int _efx_mcdi_rpc(struct efx_nic *efx, u32 client_id, unsigned int cmd,
> const efx_dword_t *inbuf, size_t inlen,
> efx_dword_t *outbuf, size_t outlen,
> size_t *outlen_actual, bool quiet, int *raw_rc)
> @@ -811,7 +842,7 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
> return -EINVAL;
> }
>
> - rc = efx_mcdi_rpc_start(efx, cmd, inbuf, inlen);
> + rc = efx_mcdi_rpc_start(efx, client_id, cmd, inbuf, inlen);
> if (rc)
> return rc;
>
> @@ -836,7 +867,8 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
>
> /* We now retry the original request. */
> mcdi->state = MCDI_STATE_RUNNING_SYNC;
> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
> + efx_mcdi_send_request(efx, efx->client_id, cmd,
> + inbuf, inlen);
>
> rc = _efx_mcdi_rpc_finish(efx, cmd, inlen,
> outbuf, outlen, outlen_actual,
> @@ -855,16 +887,44 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
> return rc;
> }
>
> +#ifdef CONFIG_SFC_VDPA
> +static bool is_mode_vdpa(struct efx_nic *efx)
> +{
> + if (efx->pci_dev->is_virtfn &&
> + efx->pci_dev->physfn &&
> + efx->state == STATE_VDPA &&
> + efx->vdpa_nic)
> + return true;
> +
> + return false;
> +}
> +#endif
> +
> static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
> const efx_dword_t *inbuf, size_t inlen,
> efx_dword_t *outbuf, size_t outlen,
> size_t *outlen_actual, bool quiet)
> {
> +#ifdef CONFIG_SFC_VDPA
> + struct efx_nic *efx_pf;
> +#endif
> int raw_rc = 0;
> int rc;
>
> - rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
> - outbuf, outlen, outlen_actual, true, &raw_rc);
> +#ifdef CONFIG_SFC_VDPA
> + if (is_mode_vdpa(efx)) {
> + efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
> + rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd, inbuf,
> + inlen, outbuf, outlen, outlen_actual,
> + true, &raw_rc);
> + } else {
> +#endif
> + rc = _efx_mcdi_rpc(efx, efx->client_id, cmd, inbuf,
> + inlen, outbuf, outlen, outlen_actual, true,
> + &raw_rc);
> +#ifdef CONFIG_SFC_VDPA
> + }
> +#endif
>
> if ((rc == -EPROTO) && (raw_rc == MC_CMD_ERR_NO_EVB_PORT) &&
> efx->type->is_vf) {
> @@ -881,9 +941,22 @@ static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
>
> do {
> usleep_range(delay_us, delay_us + 10000);
> - rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
> - outbuf, outlen, outlen_actual,
> - true, &raw_rc);
> +#ifdef CONFIG_SFC_VDPA
> + if (is_mode_vdpa(efx)) {
> + efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
> + rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd,
> + inbuf, inlen, outbuf, outlen,
> + outlen_actual, true,
> + &raw_rc);
> + } else {
> +#endif
> + rc = _efx_mcdi_rpc(efx, efx->client_id,
> + cmd, inbuf, inlen, outbuf,
> + outlen, outlen_actual, true,
> + &raw_rc);
> +#ifdef CONFIG_SFC_VDPA
> + }
> +#endif
> if (delay_us < 100000)
> delay_us <<= 1;
> } while ((rc == -EPROTO) &&
> @@ -939,7 +1012,7 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
> * function and is then responsible for calling efx_mcdi_display_error
> * as needed.
> */
> -int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
> +int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned int cmd,
> const efx_dword_t *inbuf, size_t inlen,
> efx_dword_t *outbuf, size_t outlen,
> size_t *outlen_actual)
> @@ -948,7 +1021,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
> outlen_actual, true);
> }
>
> -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
> +int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
> const efx_dword_t *inbuf, size_t inlen)
> {
> struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
> @@ -965,7 +1038,7 @@ int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
> return -ENETDOWN;
>
> efx_mcdi_acquire_sync(mcdi);
> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
> + efx_mcdi_send_request(efx, client_id, cmd, inbuf, inlen);
> return 0;
> }
>
> @@ -1009,7 +1082,8 @@ static int _efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd,
> */
> if (mcdi->async_list.next == &async->list &&
> efx_mcdi_acquire_async(mcdi)) {
> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
> + efx_mcdi_send_request(efx, efx->client_id,
> + cmd, inbuf, inlen);
> mod_timer(&mcdi->async_timer,
> jiffies + MCDI_RPC_TIMEOUT);
> }
> diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
> index dafab52aaef7..2c526d2edeb6 100644
> --- a/drivers/net/ethernet/sfc/mcdi.h
> +++ b/drivers/net/ethernet/sfc/mcdi.h
> @@ -150,7 +150,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
> efx_dword_t *outbuf, size_t outlen,
> size_t *outlen_actual);
>
> -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
> +int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
> const efx_dword_t *inbuf, size_t inlen);
> int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
> efx_dword_t *outbuf, size_t outlen,
> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
> index 1da71deac71c..948c7a06403a 100644
> --- a/drivers/net/ethernet/sfc/net_driver.h
> +++ b/drivers/net/ethernet/sfc/net_driver.h
> @@ -859,6 +859,7 @@ struct efx_mae;
> * @secondary_list: List of &struct efx_nic instances for the secondary PCI
> * functions of the controller, if this is for the primary function.
> * Serialised by rtnl_lock.
> + * @client_id: client ID of this PCIe function
> * @type: Controller type attributes
> * @legacy_irq: IRQ number
> * @workqueue: Workqueue for port reconfigures and the HW monitor.
> @@ -1022,6 +1023,7 @@ struct efx_nic {
> struct list_head secondary_list;
> struct pci_dev *pci_dev;
> unsigned int port_num;
> + u32 client_id;
> const struct efx_nic_type *type;
> int legacy_irq;
> bool eeh_disabled_legacy_irq;
> diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
> index 9f07e1ba7780..d90d4f6b3824 100644
> --- a/drivers/net/ethernet/sfc/ptp.c
> +++ b/drivers/net/ethernet/sfc/ptp.c
> @@ -1052,8 +1052,8 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
>
> /* Clear flag that signals MC ready */
> WRITE_ONCE(*start, 0);
> - rc = efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf,
> - MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
> + rc = efx_mcdi_rpc_start(efx, MC_CMD_CLIENT_ID_SELF, MC_CMD_PTP,
> + synch_buf, MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
> EFX_WARN_ON_ONCE_PARANOID(rc);
>
> /* Wait for start from MCDI (or timeout) */
> --
> 2.30.1
>


2023-03-10 05:07:59

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 12/14] sfc: unmap VF's MCDI buffer when switching to vDPA mode

On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]> wrote:
>
> To avoid clash of IOVA range of VF's MCDI DMA buffer with the guest
> buffer IOVAs, unmap the MCDI buffer when switching to vDPA mode
> and use PF's IOMMU domain for running VF's MCDI commands.
>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/ef100_nic.c | 1 -
> drivers/net/ethernet/sfc/ef100_vdpa.c | 25 ++++++++++++++++
> drivers/net/ethernet/sfc/ef100_vdpa.h | 3 ++
> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 35 +++++++++++++++++++++++
> drivers/net/ethernet/sfc/mcdi.h | 3 ++
> drivers/net/ethernet/sfc/net_driver.h | 12 ++++++++
> 6 files changed, 78 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> index cd9f724a9e64..1bffc1994ed8 100644
> --- a/drivers/net/ethernet/sfc/ef100_nic.c
> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> @@ -33,7 +33,6 @@
>
> #define EF100_MAX_VIS 4096
> #define EF100_NUM_MCDI_BUFFERS 1
> -#define MCDI_BUF_LEN (8 + MCDI_CTL_SDU_LEN_MAX)
>
> #define EF100_RESET_PORT ((ETH_RESET_MAC | ETH_RESET_PHY) << ETH_RESET_SHARED_SHIFT)
>
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
> index 5c9f29f881a6..30ca4ab00175 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
> @@ -223,10 +223,19 @@ static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)
> static void ef100_vdpa_delete(struct efx_nic *efx)
> {
> struct vdpa_device *vdpa_dev;
> + int rc;
>
> if (efx->vdpa_nic) {
> vdpa_dev = &efx->vdpa_nic->vdpa_dev;
> ef100_vdpa_reset(vdpa_dev);
> + if (efx->mcdi_buf_mode == EFX_BUF_MODE_VDPA) {
> + rc = ef100_vdpa_map_mcdi_buffer(efx);
> + if (rc) {
> + pci_err(efx->pci_dev,
> + "map_mcdi_buffer failed, err: %d\n",
> + rc);
> + }
> + }
>
> /* replace with _vdpa_unregister_device later */
> put_device(&vdpa_dev->dev);
> @@ -276,6 +285,21 @@ static int get_net_config(struct ef100_vdpa_nic *vdpa_nic)
> return 0;
> }
>
> +static void unmap_mcdi_buffer(struct efx_nic *efx)
> +{
> + struct ef100_nic_data *nic_data = efx->nic_data;
> + struct efx_mcdi_iface *mcdi;
> +
> + mcdi = efx_mcdi(efx);
> + spin_lock_bh(&mcdi->iface_lock);
> + /* Save current MCDI mode to be restored later */
> + efx->vdpa_nic->mcdi_mode = mcdi->mode;
> + efx->mcdi_buf_mode = EFX_BUF_MODE_VDPA;
> + mcdi->mode = MCDI_MODE_FAIL;
> + spin_unlock_bh(&mcdi->iface_lock);
> + efx_nic_free_buffer(efx, &nic_data->mcdi_buf);
> +}
> +
> static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> const char *dev_name,
> enum ef100_vdpa_class dev_type,
> @@ -342,6 +366,7 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
> for (i = 0; i < EF100_VDPA_MAC_FILTER_NTYPES; i++)
> vdpa_nic->filters[i].filter_id = EFX_INVALID_FILTER_ID;
>
> + unmap_mcdi_buffer(efx);
> rc = get_net_config(vdpa_nic);
> if (rc)
> goto err_put_device;
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
> index 49fb6be04eb3..0913ac2519cb 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
> @@ -147,6 +147,7 @@ struct ef100_vdpa_filter {
> * @status: device status as per VIRTIO spec
> * @features: negotiated feature bits
> * @max_queue_pairs: maximum number of queue pairs supported
> + * @mcdi_mode: MCDI mode at the time of unmapping VF mcdi buffer
> * @net_config: virtio_net_config data
> * @vring: vring information of the vDPA device.
> * @mac_address: mac address of interface associated with this vdpa device
> @@ -166,6 +167,7 @@ struct ef100_vdpa_nic {
> u8 status;
> u64 features;
> u32 max_queue_pairs;
> + enum efx_mcdi_mode mcdi_mode;
> struct virtio_net_config net_config;
> struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
> u8 *mac_address;
> @@ -185,6 +187,7 @@ int ef100_vdpa_add_filter(struct ef100_vdpa_nic *vdpa_nic,
> int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
> void ef100_vdpa_irq_vectors_free(void *data);
> int ef100_vdpa_reset(struct vdpa_device *vdev);
> +int ef100_vdpa_map_mcdi_buffer(struct efx_nic *efx);
>
> static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
> {
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> index db86c2693950..c6c9458f0e6f 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> @@ -711,12 +711,47 @@ static int ef100_vdpa_suspend(struct vdpa_device *vdev)
> mutex_unlock(&vdpa_nic->lock);
> return rc;
> }
> +
> +int ef100_vdpa_map_mcdi_buffer(struct efx_nic *efx)
> +{

The name of this function is confusing, it's actually map buffer for
ef100 netdev mode.

Actually, I wonder why not moving this to init/fini of bar config ops
or if we use aux bus, it should be done during aux driver
probe/remove.

Thanks


> + struct ef100_nic_data *nic_data = efx->nic_data;
> + struct efx_mcdi_iface *mcdi;
> + int rc;
> +
> + /* Update VF's MCDI buffer when switching out of vdpa mode */
> + rc = efx_nic_alloc_buffer(efx, &nic_data->mcdi_buf,
> + MCDI_BUF_LEN, GFP_KERNEL);
> + if (rc)
> + return rc;
> +
> + mcdi = efx_mcdi(efx);
> + spin_lock_bh(&mcdi->iface_lock);
> + mcdi->mode = efx->vdpa_nic->mcdi_mode;
> + efx->mcdi_buf_mode = EFX_BUF_MODE_EF100;
> + spin_unlock_bh(&mcdi->iface_lock);
> +
> + return 0;
> +}
> +
> static void ef100_vdpa_free(struct vdpa_device *vdev)
> {
> struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
> + int rc;
> int i;
>
> if (vdpa_nic) {
> + if (vdpa_nic->efx->mcdi_buf_mode == EFX_BUF_MODE_VDPA) {
> + /* This will only be called via call to put_device()
> + * on vdpa device creation failure
> + */
> + rc = ef100_vdpa_map_mcdi_buffer(vdpa_nic->efx);
> + if (rc) {
> + dev_err(&vdev->dev,
> + "map_mcdi_buffer failed, err: %d\n",
> + rc);
> + }
> + }
> +
> for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
> reset_vring(vdpa_nic, i);
> if (vdpa_nic->vring[i].vring_ctx)
> diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
> index 2c526d2edeb6..bc4de3b4e6f3 100644
> --- a/drivers/net/ethernet/sfc/mcdi.h
> +++ b/drivers/net/ethernet/sfc/mcdi.h
> @@ -6,6 +6,9 @@
>
> #ifndef EFX_MCDI_H
> #define EFX_MCDI_H
> +#include "mcdi_pcol.h"
> +
> +#define MCDI_BUF_LEN (8 + MCDI_CTL_SDU_LEN_MAX)
>
> /**
> * enum efx_mcdi_state - MCDI request handling state
> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
> index 948c7a06403a..9cdfeb6ad05a 100644
> --- a/drivers/net/ethernet/sfc/net_driver.h
> +++ b/drivers/net/ethernet/sfc/net_driver.h
> @@ -848,6 +848,16 @@ enum efx_xdp_tx_queues_mode {
>
> struct efx_mae;
>
> +/**
> + * enum efx_buf_alloc_mode - buffer allocation mode
> + * @EFX_BUF_MODE_EF100: buffer setup in ef100 mode
> + * @EFX_BUF_MODE_VDPA: buffer setup in vdpa mode
> + */
> +enum efx_buf_alloc_mode {
> + EFX_BUF_MODE_EF100,
> + EFX_BUF_MODE_VDPA
> +};
> +
> /**
> * struct efx_nic - an Efx NIC
> * @name: Device name (net device name or bus id before net device registered)
> @@ -877,6 +887,7 @@ struct efx_mae;
> * @irq_rx_mod_step_us: Step size for IRQ moderation for RX event queues
> * @irq_rx_moderation_us: IRQ moderation time for RX event queues
> * @msg_enable: Log message enable flags
> + * @mcdi_buf_mode: mcdi buffer allocation mode
> * @state: Device state number (%STATE_*). Serialised by the rtnl_lock.
> * @reset_pending: Bitmask for pending resets
> * @tx_queue: TX DMA queues
> @@ -1045,6 +1056,7 @@ struct efx_nic {
> u32 msg_enable;
>
> enum nic_state state;
> + enum efx_buf_alloc_mode mcdi_buf_mode;
> unsigned long reset_pending;
>
> struct efx_channel *channel[EFX_MAX_CHANNELS];
> --
> 2.30.1
>


2023-03-10 05:08:04

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 13/14] sfc: update vdpa device MAC address

On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]> wrote:
>
> As the VF MAC address can now be updated using `devlink port function set`

What happens if we run this while the vpda is being used by a VM?

> interface, fetch the vdpa device MAC address from the underlying VF during
> vdpa device creation.
>
> Signed-off-by: Gautam Dawar <[email protected]>
> ---
> drivers/net/ethernet/sfc/ef100_vdpa.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
> index 30ca4ab00175..32182a01f6a5 100644
> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
> @@ -272,6 +272,18 @@ static int get_net_config(struct ef100_vdpa_nic *vdpa_nic)
> vdpa_nic->net_config.max_virtqueue_pairs =
> cpu_to_efx_vdpa16(vdpa_nic, vdpa_nic->max_queue_pairs);
>
> + rc = ef100_get_mac_address(efx, vdpa_nic->mac_address,
> + efx->client_id, true);
> + if (rc) {
> + dev_err(&vdpa_nic->vdpa_dev.dev,
> + "%s: Get MAC for vf:%u failed:%d\n", __func__,
> + vdpa_nic->vf_index, rc);
> + return rc;
> + }

Can this override what is provisioned by the userspace?

Thanks


> +
> + if (is_valid_ether_addr(vdpa_nic->mac_address))
> + vdpa_nic->mac_configured = true;
> +
> rc = efx_vdpa_get_mtu(efx, &mtu);
> if (rc) {
> dev_err(&vdpa_nic->vdpa_dev.dev,
> --
> 2.30.1
>


2023-03-10 05:11:34

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 00/14] sfc: add vDPA support for EF100 devices

On Tue, Mar 7, 2023 at 7:36 PM Gautam Dawar <[email protected]> wrote:
>
> Hi All,
>
> This series adds the vdpa support for EF100 devices.

Would you mind posting some performance numbers for this device?

Thanks

> For now, only a network class of vdpa device is supported and
> they can be created only on a VF. Each EF100 VF can have one
> of the three function personalities (EF100, vDPA & None) at
> any time with EF100 being the default. A VF's function personality
> is changed to vDPA while creating the vdpa device using vdpa tool.
>
> A vDPA management device is created per VF to allow selection of
> the desired VF for vDPA device creation. The MAC address for the
> target net device must be set either by specifying at the vdpa
> device creation time via the `mac` parameter of the `vdpa dev add`
> command or should be specified as the hardware address of the virtual
> function using `devlink port function set hw_addr` command before
> creating the vdpa device with the former taking precedence.
>
> Changes since v1:
>
> - To ensure isolation between DMA initiated by userspace (guest OS)
> and the host MCDI buffer, ummap VF's MCDI DMA buffer and use PF's
> IOMMU domain instead for executing vDPA VF's MCDI commands.
> - As a result of above change, it is no more necessary to check for
> MCDI buffer's IOVA range overlap with the guest buffers. Accordingly,
> the DMA config operations and the rbtree/list implementation to store
> IOVA mappings have been dropped.
> - Support vDPA only if running Firmware supports CLIENT_CMD_VF_PROXY
> capability.
> - Added .suspend config operation and updated get_vq_state/set_vq_state
> to support Live Migration. Also, features VIRTIO_F_ORDER_PLATFORM and
> VIRTIO_F_IN_ORDER have been masked off in get_device_features() to
> allow Live Migration as QEMU SVQ doesn't support them yet.
> - Removed the minimum version (v6.1.0) requirement of QEMU as
> VIRTIO_F_IN_ORDER is not exposed
> - Fetch the vdpa device MAC address from the underlying VF hw_addr (if
> set via `devlink port function set hw_addr` command)
> - Removed the mandatory requirement of specifying mac address while
> creating vdpa device
> - Moved create_vring_ctx() and get_doorbell_offset() in dev_add()
> - Moved IRQ allocation at the time of vring creation
> - Merged vring_created member of struct ef100_vdpa_vring_info as one
> of the flags in vring_state
> - Simplified .set_status() implementation
> - Removed un-necessary vdpa_state checks against
> EF100_VDPA_STATE_INITIALIZED
> - Removed userspace triggerable warning in kick_vq()
> - Updated year 2023 in copyright banner of new files
>
> Gautam Dawar (14):
> sfc: add function personality support for EF100 devices
> sfc: implement MCDI interface for vDPA operations
> sfc: update MCDI headers for CLIENT_CMD_VF_PROXY capability bit
> sfc: evaluate vdpa support based on FW capability CLIENT_CMD_VF_PROXY
> sfc: implement init and fini functions for vDPA personality
> sfc: implement vDPA management device operations
> sfc: implement vdpa device config operations
> sfc: implement vdpa vring config operations
> sfc: implement device status related vdpa config operations
> sfc: implement filters for receiving traffic
> sfc: use PF's IOMMU domain for running VF's MCDI commands
> sfc: unmap VF's MCDI buffer when switching to vDPA mode
> sfc: update vdpa device MAC address
> sfc: register the vDPA device
>
> drivers/net/ethernet/sfc/Kconfig | 8 +
> drivers/net/ethernet/sfc/Makefile | 1 +
> drivers/net/ethernet/sfc/ef10.c | 2 +-
> drivers/net/ethernet/sfc/ef100.c | 7 +-
> drivers/net/ethernet/sfc/ef100_netdev.c | 26 +-
> drivers/net/ethernet/sfc/ef100_nic.c | 183 +-
> drivers/net/ethernet/sfc/ef100_nic.h | 26 +-
> drivers/net/ethernet/sfc/ef100_vdpa.c | 543 +++
> drivers/net/ethernet/sfc/ef100_vdpa.h | 224 ++
> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 793 ++++
> drivers/net/ethernet/sfc/mcdi.c | 108 +-
> drivers/net/ethernet/sfc/mcdi.h | 9 +-
> drivers/net/ethernet/sfc/mcdi_filters.c | 51 +-
> drivers/net/ethernet/sfc/mcdi_functions.c | 9 +-
> drivers/net/ethernet/sfc/mcdi_functions.h | 3 +-
> drivers/net/ethernet/sfc/mcdi_pcol.h | 4390 ++++++++++++++++++++-
> drivers/net/ethernet/sfc/mcdi_vdpa.c | 259 ++
> drivers/net/ethernet/sfc/mcdi_vdpa.h | 83 +
> drivers/net/ethernet/sfc/net_driver.h | 21 +
> drivers/net/ethernet/sfc/ptp.c | 4 +-
> 20 files changed, 6574 insertions(+), 176 deletions(-)
> create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa.c
> create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa.h
> create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa_ops.c
> create mode 100644 drivers/net/ethernet/sfc/mcdi_vdpa.c
> create mode 100644 drivers/net/ethernet/sfc/mcdi_vdpa.h
>
> --
> 2.30.1
>


2023-03-13 06:30:03

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 00/14] sfc: add vDPA support for EF100 devices


On 3/10/23 10:39, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 7, 2023 at 7:36 PM Gautam Dawar <[email protected]> wrote:
>> Hi All,
>>
>> This series adds the vdpa support for EF100 devices.
> Would you mind posting some performance numbers for this device?

Sure, will do with the next version of this patch series.

Thanks

> Thanks
>
>> For now, only a network class of vdpa device is supported and
>> they can be created only on a VF. Each EF100 VF can have one
>> of the three function personalities (EF100, vDPA & None) at
>> any time with EF100 being the default. A VF's function personality
>> is changed to vDPA while creating the vdpa device using vdpa tool.
>>
>> A vDPA management device is created per VF to allow selection of
>> the desired VF for vDPA device creation. The MAC address for the
>> target net device must be set either by specifying at the vdpa
>> device creation time via the `mac` parameter of the `vdpa dev add`
>> command or should be specified as the hardware address of the virtual
>> function using `devlink port function set hw_addr` command before
>> creating the vdpa device with the former taking precedence.
>>
>> Changes since v1:
>>
>> - To ensure isolation between DMA initiated by userspace (guest OS)
>> and the host MCDI buffer, ummap VF's MCDI DMA buffer and use PF's
>> IOMMU domain instead for executing vDPA VF's MCDI commands.
>> - As a result of above change, it is no more necessary to check for
>> MCDI buffer's IOVA range overlap with the guest buffers. Accordingly,
>> the DMA config operations and the rbtree/list implementation to store
>> IOVA mappings have been dropped.
>> - Support vDPA only if running Firmware supports CLIENT_CMD_VF_PROXY
>> capability.
>> - Added .suspend config operation and updated get_vq_state/set_vq_state
>> to support Live Migration. Also, features VIRTIO_F_ORDER_PLATFORM and
>> VIRTIO_F_IN_ORDER have been masked off in get_device_features() to
>> allow Live Migration as QEMU SVQ doesn't support them yet.
>> - Removed the minimum version (v6.1.0) requirement of QEMU as
>> VIRTIO_F_IN_ORDER is not exposed
>> - Fetch the vdpa device MAC address from the underlying VF hw_addr (if
>> set via `devlink port function set hw_addr` command)
>> - Removed the mandatory requirement of specifying mac address while
>> creating vdpa device
>> - Moved create_vring_ctx() and get_doorbell_offset() in dev_add()
>> - Moved IRQ allocation at the time of vring creation
>> - Merged vring_created member of struct ef100_vdpa_vring_info as one
>> of the flags in vring_state
>> - Simplified .set_status() implementation
>> - Removed un-necessary vdpa_state checks against
>> EF100_VDPA_STATE_INITIALIZED
>> - Removed userspace triggerable warning in kick_vq()
>> - Updated year 2023 in copyright banner of new files
>>
>> Gautam Dawar (14):
>> sfc: add function personality support for EF100 devices
>> sfc: implement MCDI interface for vDPA operations
>> sfc: update MCDI headers for CLIENT_CMD_VF_PROXY capability bit
>> sfc: evaluate vdpa support based on FW capability CLIENT_CMD_VF_PROXY
>> sfc: implement init and fini functions for vDPA personality
>> sfc: implement vDPA management device operations
>> sfc: implement vdpa device config operations
>> sfc: implement vdpa vring config operations
>> sfc: implement device status related vdpa config operations
>> sfc: implement filters for receiving traffic
>> sfc: use PF's IOMMU domain for running VF's MCDI commands
>> sfc: unmap VF's MCDI buffer when switching to vDPA mode
>> sfc: update vdpa device MAC address
>> sfc: register the vDPA device
>>
>> drivers/net/ethernet/sfc/Kconfig | 8 +
>> drivers/net/ethernet/sfc/Makefile | 1 +
>> drivers/net/ethernet/sfc/ef10.c | 2 +-
>> drivers/net/ethernet/sfc/ef100.c | 7 +-
>> drivers/net/ethernet/sfc/ef100_netdev.c | 26 +-
>> drivers/net/ethernet/sfc/ef100_nic.c | 183 +-
>> drivers/net/ethernet/sfc/ef100_nic.h | 26 +-
>> drivers/net/ethernet/sfc/ef100_vdpa.c | 543 +++
>> drivers/net/ethernet/sfc/ef100_vdpa.h | 224 ++
>> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 793 ++++
>> drivers/net/ethernet/sfc/mcdi.c | 108 +-
>> drivers/net/ethernet/sfc/mcdi.h | 9 +-
>> drivers/net/ethernet/sfc/mcdi_filters.c | 51 +-
>> drivers/net/ethernet/sfc/mcdi_functions.c | 9 +-
>> drivers/net/ethernet/sfc/mcdi_functions.h | 3 +-
>> drivers/net/ethernet/sfc/mcdi_pcol.h | 4390 ++++++++++++++++++++-
>> drivers/net/ethernet/sfc/mcdi_vdpa.c | 259 ++
>> drivers/net/ethernet/sfc/mcdi_vdpa.h | 83 +
>> drivers/net/ethernet/sfc/net_driver.h | 21 +
>> drivers/net/ethernet/sfc/ptp.c | 4 +-
>> 20 files changed, 6574 insertions(+), 176 deletions(-)
>> create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa.c
>> create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa.h
>> create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> create mode 100644 drivers/net/ethernet/sfc/mcdi_vdpa.c
>> create mode 100644 drivers/net/ethernet/sfc/mcdi_vdpa.h
>>
>> --
>> 2.30.1
>>

2023-03-13 06:37:36

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 13/14] sfc: update vdpa device MAC address

On 3/10/23 10:35, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]> wrote:
>> As the VF MAC address can now be updated using `devlink port function set`
> What happens if we run this while the vpda is being used by a VM?
IIUC, updating the MAC address using devlink interface requires
unbinding the device from driver and hence updating the MAC while vdpa
device is in-use won't be possible. It can only be done via control vq
VIRTIO_NET_CTRL_MAC_ADDR_SET command, when available.
>
>> interface, fetch the vdpa device MAC address from the underlying VF during
>> vdpa device creation.
>>
>> Signed-off-by: Gautam Dawar <[email protected]>
>> ---
>> drivers/net/ethernet/sfc/ef100_vdpa.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> index 30ca4ab00175..32182a01f6a5 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> @@ -272,6 +272,18 @@ static int get_net_config(struct ef100_vdpa_nic *vdpa_nic)
>> vdpa_nic->net_config.max_virtqueue_pairs =
>> cpu_to_efx_vdpa16(vdpa_nic, vdpa_nic->max_queue_pairs);
>>
>> + rc = ef100_get_mac_address(efx, vdpa_nic->mac_address,
>> + efx->client_id, true);
>> + if (rc) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: Get MAC for vf:%u failed:%d\n", __func__,
>> + vdpa_nic->vf_index, rc);
>> + return rc;
>> + }
> Can this override what is provisioned by the userspace?

No, this was carefully avoided by overwriting the userspace provisioned
MAC in ef100_vdpa_create():

        rc = get_net_config(vdpa_nic);
        if (rc)
                goto err_put_device;

        if (mac) {
                ether_addr_copy(vdpa_nic->mac_address, mac);
                vdpa_nic->mac_configured = true;
        }

>
> Thanks
>
>
>> +
>> + if (is_valid_ether_addr(vdpa_nic->mac_address))
>> + vdpa_nic->mac_configured = true;
>> +
>> rc = efx_vdpa_get_mtu(efx, &mtu);
>> if (rc) {
>> dev_err(&vdpa_nic->vdpa_dev.dev,
>> --
>> 2.30.1
>>

2023-03-13 07:09:33

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 12/14] sfc: unmap VF's MCDI buffer when switching to vDPA mode


On 3/10/23 10:35, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]> wrote:
>> To avoid clash of IOVA range of VF's MCDI DMA buffer with the guest
>> buffer IOVAs, unmap the MCDI buffer when switching to vDPA mode
>> and use PF's IOMMU domain for running VF's MCDI commands.
>>
>> Signed-off-by: Gautam Dawar <[email protected]>
>> ---
>> drivers/net/ethernet/sfc/ef100_nic.c | 1 -
>> drivers/net/ethernet/sfc/ef100_vdpa.c | 25 ++++++++++++++++
>> drivers/net/ethernet/sfc/ef100_vdpa.h | 3 ++
>> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 35 +++++++++++++++++++++++
>> drivers/net/ethernet/sfc/mcdi.h | 3 ++
>> drivers/net/ethernet/sfc/net_driver.h | 12 ++++++++
>> 6 files changed, 78 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
>> index cd9f724a9e64..1bffc1994ed8 100644
>> --- a/drivers/net/ethernet/sfc/ef100_nic.c
>> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
>> @@ -33,7 +33,6 @@
>>
>> #define EF100_MAX_VIS 4096
>> #define EF100_NUM_MCDI_BUFFERS 1
>> -#define MCDI_BUF_LEN (8 + MCDI_CTL_SDU_LEN_MAX)
>>
>> #define EF100_RESET_PORT ((ETH_RESET_MAC | ETH_RESET_PHY) << ETH_RESET_SHARED_SHIFT)
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> index 5c9f29f881a6..30ca4ab00175 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> @@ -223,10 +223,19 @@ static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)
>> static void ef100_vdpa_delete(struct efx_nic *efx)
>> {
>> struct vdpa_device *vdpa_dev;
>> + int rc;
>>
>> if (efx->vdpa_nic) {
>> vdpa_dev = &efx->vdpa_nic->vdpa_dev;
>> ef100_vdpa_reset(vdpa_dev);
>> + if (efx->mcdi_buf_mode == EFX_BUF_MODE_VDPA) {
>> + rc = ef100_vdpa_map_mcdi_buffer(efx);
>> + if (rc) {
>> + pci_err(efx->pci_dev,
>> + "map_mcdi_buffer failed, err: %d\n",
>> + rc);
>> + }
>> + }
>>
>> /* replace with _vdpa_unregister_device later */
>> put_device(&vdpa_dev->dev);
>> @@ -276,6 +285,21 @@ static int get_net_config(struct ef100_vdpa_nic *vdpa_nic)
>> return 0;
>> }
>>
>> +static void unmap_mcdi_buffer(struct efx_nic *efx)
>> +{
>> + struct ef100_nic_data *nic_data = efx->nic_data;
>> + struct efx_mcdi_iface *mcdi;
>> +
>> + mcdi = efx_mcdi(efx);
>> + spin_lock_bh(&mcdi->iface_lock);
>> + /* Save current MCDI mode to be restored later */
>> + efx->vdpa_nic->mcdi_mode = mcdi->mode;
>> + efx->mcdi_buf_mode = EFX_BUF_MODE_VDPA;
>> + mcdi->mode = MCDI_MODE_FAIL;
>> + spin_unlock_bh(&mcdi->iface_lock);
>> + efx_nic_free_buffer(efx, &nic_data->mcdi_buf);
>> +}
>> +
>> static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> const char *dev_name,
>> enum ef100_vdpa_class dev_type,
>> @@ -342,6 +366,7 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> for (i = 0; i < EF100_VDPA_MAC_FILTER_NTYPES; i++)
>> vdpa_nic->filters[i].filter_id = EFX_INVALID_FILTER_ID;
>>
>> + unmap_mcdi_buffer(efx);
>> rc = get_net_config(vdpa_nic);
>> if (rc)
>> goto err_put_device;
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> index 49fb6be04eb3..0913ac2519cb 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> @@ -147,6 +147,7 @@ struct ef100_vdpa_filter {
>> * @status: device status as per VIRTIO spec
>> * @features: negotiated feature bits
>> * @max_queue_pairs: maximum number of queue pairs supported
>> + * @mcdi_mode: MCDI mode at the time of unmapping VF mcdi buffer
>> * @net_config: virtio_net_config data
>> * @vring: vring information of the vDPA device.
>> * @mac_address: mac address of interface associated with this vdpa device
>> @@ -166,6 +167,7 @@ struct ef100_vdpa_nic {
>> u8 status;
>> u64 features;
>> u32 max_queue_pairs;
>> + enum efx_mcdi_mode mcdi_mode;
>> struct virtio_net_config net_config;
>> struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
>> u8 *mac_address;
>> @@ -185,6 +187,7 @@ int ef100_vdpa_add_filter(struct ef100_vdpa_nic *vdpa_nic,
>> int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>> void ef100_vdpa_irq_vectors_free(void *data);
>> int ef100_vdpa_reset(struct vdpa_device *vdev);
>> +int ef100_vdpa_map_mcdi_buffer(struct efx_nic *efx);
>>
>> static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
>> {
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> index db86c2693950..c6c9458f0e6f 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> @@ -711,12 +711,47 @@ static int ef100_vdpa_suspend(struct vdpa_device *vdev)
>> mutex_unlock(&vdpa_nic->lock);
>> return rc;
>> }
>> +
>> +int ef100_vdpa_map_mcdi_buffer(struct efx_nic *efx)
>> +{
> The name of this function is confusing, it's actually map buffer for
> ef100 netdev mode.

Yeah, I get your point. Actually, I am using the prefix ef100_vdpa_ for
extern functions and this function is just mapping the  MCDI buffer
resulting in the name ef100_vdpa_map_mcdi_buffer().

I think ef100_vdpa_map_vf_mcdi_buffer() would remove this confusion.
What do you think?

>
> Actually, I wonder why not moving this to init/fini of bar config ops
> or if we use aux bus, it should be done during aux driver
> probe/remove.
It makes sense, however we store the last mcdi mode (poll or events) in
vdpa_nic->mcdi_mode to restore later, which requires vdpa_nic to be
allocated that happens later than switching to vdpa bar_config.
> Thanks
>
>
>> + struct ef100_nic_data *nic_data = efx->nic_data;
>> + struct efx_mcdi_iface *mcdi;
>> + int rc;
>> +
>> + /* Update VF's MCDI buffer when switching out of vdpa mode */
>> + rc = efx_nic_alloc_buffer(efx, &nic_data->mcdi_buf,
>> + MCDI_BUF_LEN, GFP_KERNEL);
>> + if (rc)
>> + return rc;
>> +
>> + mcdi = efx_mcdi(efx);
>> + spin_lock_bh(&mcdi->iface_lock);
>> + mcdi->mode = efx->vdpa_nic->mcdi_mode;
>> + efx->mcdi_buf_mode = EFX_BUF_MODE_EF100;
>> + spin_unlock_bh(&mcdi->iface_lock);
>> +
>> + return 0;
>> +}
>> +
>> static void ef100_vdpa_free(struct vdpa_device *vdev)
>> {
>> struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + int rc;
>> int i;
>>
>> if (vdpa_nic) {
>> + if (vdpa_nic->efx->mcdi_buf_mode == EFX_BUF_MODE_VDPA) {
>> + /* This will only be called via call to put_device()
>> + * on vdpa device creation failure
>> + */
>> + rc = ef100_vdpa_map_mcdi_buffer(vdpa_nic->efx);
>> + if (rc) {
>> + dev_err(&vdev->dev,
>> + "map_mcdi_buffer failed, err: %d\n",
>> + rc);
>> + }
>> + }
>> +
>> for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>> reset_vring(vdpa_nic, i);
>> if (vdpa_nic->vring[i].vring_ctx)
>> diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
>> index 2c526d2edeb6..bc4de3b4e6f3 100644
>> --- a/drivers/net/ethernet/sfc/mcdi.h
>> +++ b/drivers/net/ethernet/sfc/mcdi.h
>> @@ -6,6 +6,9 @@
>>
>> #ifndef EFX_MCDI_H
>> #define EFX_MCDI_H
>> +#include "mcdi_pcol.h"
>> +
>> +#define MCDI_BUF_LEN (8 + MCDI_CTL_SDU_LEN_MAX)
>>
>> /**
>> * enum efx_mcdi_state - MCDI request handling state
>> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
>> index 948c7a06403a..9cdfeb6ad05a 100644
>> --- a/drivers/net/ethernet/sfc/net_driver.h
>> +++ b/drivers/net/ethernet/sfc/net_driver.h
>> @@ -848,6 +848,16 @@ enum efx_xdp_tx_queues_mode {
>>
>> struct efx_mae;
>>
>> +/**
>> + * enum efx_buf_alloc_mode - buffer allocation mode
>> + * @EFX_BUF_MODE_EF100: buffer setup in ef100 mode
>> + * @EFX_BUF_MODE_VDPA: buffer setup in vdpa mode
>> + */
>> +enum efx_buf_alloc_mode {
>> + EFX_BUF_MODE_EF100,
>> + EFX_BUF_MODE_VDPA
>> +};
>> +
>> /**
>> * struct efx_nic - an Efx NIC
>> * @name: Device name (net device name or bus id before net device registered)
>> @@ -877,6 +887,7 @@ struct efx_mae;
>> * @irq_rx_mod_step_us: Step size for IRQ moderation for RX event queues
>> * @irq_rx_moderation_us: IRQ moderation time for RX event queues
>> * @msg_enable: Log message enable flags
>> + * @mcdi_buf_mode: mcdi buffer allocation mode
>> * @state: Device state number (%STATE_*). Serialised by the rtnl_lock.
>> * @reset_pending: Bitmask for pending resets
>> * @tx_queue: TX DMA queues
>> @@ -1045,6 +1056,7 @@ struct efx_nic {
>> u32 msg_enable;
>>
>> enum nic_state state;
>> + enum efx_buf_alloc_mode mcdi_buf_mode;
>> unsigned long reset_pending;
>>
>> struct efx_channel *channel[EFX_MAX_CHANNELS];
>> --
>> 2.30.1
>>

2023-03-13 07:35:52

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 11/14] sfc: use PF's IOMMU domain for running VF's MCDI commands


On 3/10/23 10:35, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]> wrote:
>> This changeset uses MC_CMD_CLIENT_CMD to execute VF's MCDI
>> commands when running in vDPA mode (STATE_VDPA).
>> Also, use the PF's IOMMU domain for executing the encapsulated
>> VF's MCDI commands to isolate DMA of guest buffers in the VF's
>> IOMMU domain.
>> This patch also updates the PCIe FN's client id in the efx_nic
>> structure which is required while running MC_CMD_CLIENT_CMD.
>>
>> Signed-off-by: Gautam Dawar <[email protected]>
>> ---
>> drivers/net/ethernet/sfc/ef100.c | 1 +
>> drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++
>> drivers/net/ethernet/sfc/mcdi.c | 108 ++++++++++++++++++++++----
>> drivers/net/ethernet/sfc/mcdi.h | 2 +-
>> drivers/net/ethernet/sfc/net_driver.h | 2 +
>> drivers/net/ethernet/sfc/ptp.c | 4 +-
>> 6 files changed, 132 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
>> index c1c69783db7b..8453c9ba0f41 100644
>> --- a/drivers/net/ethernet/sfc/ef100.c
>> +++ b/drivers/net/ethernet/sfc/ef100.c
>> @@ -465,6 +465,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
>> efx->type = (const struct efx_nic_type *)entry->driver_data;
>>
>> efx->pci_dev = pci_dev;
>> + efx->client_id = MC_CMD_CLIENT_ID_SELF;
>> pci_set_drvdata(pci_dev, efx);
>> rc = efx_init_struct(efx, pci_dev);
>> if (rc)
>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
>> index bda4fcbe1126..cd9f724a9e64 100644
>> --- a/drivers/net/ethernet/sfc/ef100_nic.c
>> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
>> @@ -206,9 +206,11 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
>> "firmware reports num_mac_stats = %u\n",
>> efx->num_mac_stats);
>>
>> +#ifdef CONFIG_SFC_VDPA
>> nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
>> CLIENT_CMD_VF_PROXY) &&
>> efx->type->is_vf;
>> +#endif
> This should be done at patch 4?
Yeah, right. Will fix.
>
>> return 0;
>> }
>>
>> @@ -1086,6 +1088,35 @@ static int ef100_check_design_params(struct efx_nic *efx)
>> return rc;
>> }
>>
>> +static int efx_ef100_update_client_id(struct efx_nic *efx)
>> +{
>> + struct ef100_nic_data *nic_data = efx->nic_data;
>> + unsigned int pf_index = PCIE_FUNCTION_PF_NULL;
>> + unsigned int vf_index = PCIE_FUNCTION_VF_NULL;
>> + efx_qword_t pciefn;
>> + int rc;
>> +
>> + if (efx->pci_dev->is_virtfn)
>> + vf_index = nic_data->vf_index;
>> + else
>> + pf_index = nic_data->pf_index;
>> +
>> + /* Construct PCIE_FUNCTION structure */
>> + EFX_POPULATE_QWORD_3(pciefn,
>> + PCIE_FUNCTION_PF, pf_index,
>> + PCIE_FUNCTION_VF, vf_index,
>> + PCIE_FUNCTION_INTF, PCIE_INTERFACE_CALLER);
>> + /* look up self client ID */
>> + rc = efx_ef100_lookup_client_id(efx, pciefn, &efx->client_id);
>> + if (rc) {
>> + pci_warn(efx->pci_dev,
>> + "%s: Failed to get client ID, rc %d\n",
>> + __func__, rc);
>> + }
>> +
>> + return rc;
>> +}
>> +
>> /* NIC probe and remove
>> */
>> static int ef100_probe_main(struct efx_nic *efx)
>> @@ -1173,6 +1204,10 @@ static int ef100_probe_main(struct efx_nic *efx)
>> goto fail;
>> efx->port_num = rc;
>>
>> + rc = efx_ef100_update_client_id(efx);
>> + if (rc)
>> + goto fail;
>> +
>> efx_mcdi_print_fwver(efx, fw_version, sizeof(fw_version));
>> pci_dbg(efx->pci_dev, "Firmware version %s\n", fw_version);
>>
>> diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
>> index a7f2c31071e8..3bf1ebe05775 100644
>> --- a/drivers/net/ethernet/sfc/mcdi.c
>> +++ b/drivers/net/ethernet/sfc/mcdi.c
>> @@ -145,14 +145,15 @@ void efx_mcdi_fini(struct efx_nic *efx)
>> kfree(efx->mcdi);
>> }
>>
>> -static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
>> - const efx_dword_t *inbuf, size_t inlen)
>> +static void efx_mcdi_send_request(struct efx_nic *efx, u32 client_id,
>> + unsigned int cmd, const efx_dword_t *inbuf,
>> + size_t inlen)
>> {
>> struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
>> #ifdef CONFIG_SFC_MCDI_LOGGING
>> char *buf = mcdi->logging_buffer; /* page-sized */
>> #endif
>> - efx_dword_t hdr[2];
>> + efx_dword_t hdr[5];
>> size_t hdr_len;
>> u32 xflags, seqno;
>>
>> @@ -179,7 +180,7 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
>> MCDI_HEADER_XFLAGS, xflags,
>> MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
>> hdr_len = 4;
>> - } else {
>> + } else if (client_id == efx->client_id) {
>> /* MCDI v2 */
>> BUG_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
>> EFX_POPULATE_DWORD_7(hdr[0],
>> @@ -194,6 +195,35 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
>> MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
>> MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
>> hdr_len = 8;
>> + } else {
>> + /* MCDI v2 */
> Just wonder if V2 is a must for vDPA? If yes we probably need to fail
> vDPA creation without it.

Agreed, will add this condition in evaluation of nic_data->vdpa_supported.

Thanks

>
> Thanks
>
>
>> + WARN_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
>> + /* MCDI v2 with credentials of a different client */
>> + BUILD_BUG_ON(MC_CMD_CLIENT_CMD_IN_LEN != 4);
>> + /* Outer CLIENT_CMD wrapper command with client ID */
>> + EFX_POPULATE_DWORD_7(hdr[0],
>> + MCDI_HEADER_RESPONSE, 0,
>> + MCDI_HEADER_RESYNC, 1,
>> + MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
>> + MCDI_HEADER_DATALEN, 0,
>> + MCDI_HEADER_SEQ, seqno,
>> + MCDI_HEADER_XFLAGS, xflags,
>> + MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
>> + EFX_POPULATE_DWORD_2(hdr[1],
>> + MC_CMD_V2_EXTN_IN_EXTENDED_CMD,
>> + MC_CMD_CLIENT_CMD,
>> + MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen + 12);
>> + MCDI_SET_DWORD(&hdr[2],
>> + CLIENT_CMD_IN_CLIENT_ID, client_id);
>> +
>> + /* MCDIv2 header for inner command */
>> + EFX_POPULATE_DWORD_2(hdr[3],
>> + MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
>> + MCDI_HEADER_DATALEN, 0);
>> + EFX_POPULATE_DWORD_2(hdr[4],
>> + MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
>> + MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
>> + hdr_len = 20;
>> }
>>
>> #ifdef CONFIG_SFC_MCDI_LOGGING
>> @@ -474,7 +504,8 @@ static void efx_mcdi_release(struct efx_mcdi_iface *mcdi)
>> &mcdi->async_list, struct efx_mcdi_async_param, list);
>> if (async) {
>> mcdi->state = MCDI_STATE_RUNNING_ASYNC;
>> - efx_mcdi_send_request(efx, async->cmd,
>> + efx_mcdi_send_request(efx, efx->client_id,
>> + async->cmd,
>> (const efx_dword_t *)(async + 1),
>> async->inlen);
>> mod_timer(&mcdi->async_timer,
>> @@ -797,7 +828,7 @@ static int efx_mcdi_proxy_wait(struct efx_nic *efx, u32 handle, bool quiet)
>> return mcdi->proxy_rx_status;
>> }
>>
>> -static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
>> +static int _efx_mcdi_rpc(struct efx_nic *efx, u32 client_id, unsigned int cmd,
>> const efx_dword_t *inbuf, size_t inlen,
>> efx_dword_t *outbuf, size_t outlen,
>> size_t *outlen_actual, bool quiet, int *raw_rc)
>> @@ -811,7 +842,7 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
>> return -EINVAL;
>> }
>>
>> - rc = efx_mcdi_rpc_start(efx, cmd, inbuf, inlen);
>> + rc = efx_mcdi_rpc_start(efx, client_id, cmd, inbuf, inlen);
>> if (rc)
>> return rc;
>>
>> @@ -836,7 +867,8 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
>>
>> /* We now retry the original request. */
>> mcdi->state = MCDI_STATE_RUNNING_SYNC;
>> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
>> + efx_mcdi_send_request(efx, efx->client_id, cmd,
>> + inbuf, inlen);
>>
>> rc = _efx_mcdi_rpc_finish(efx, cmd, inlen,
>> outbuf, outlen, outlen_actual,
>> @@ -855,16 +887,44 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
>> return rc;
>> }
>>
>> +#ifdef CONFIG_SFC_VDPA
>> +static bool is_mode_vdpa(struct efx_nic *efx)
>> +{
>> + if (efx->pci_dev->is_virtfn &&
>> + efx->pci_dev->physfn &&
>> + efx->state == STATE_VDPA &&
>> + efx->vdpa_nic)
>> + return true;
>> +
>> + return false;
>> +}
>> +#endif
>> +
>> static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
>> const efx_dword_t *inbuf, size_t inlen,
>> efx_dword_t *outbuf, size_t outlen,
>> size_t *outlen_actual, bool quiet)
>> {
>> +#ifdef CONFIG_SFC_VDPA
>> + struct efx_nic *efx_pf;
>> +#endif
>> int raw_rc = 0;
>> int rc;
>>
>> - rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
>> - outbuf, outlen, outlen_actual, true, &raw_rc);
>> +#ifdef CONFIG_SFC_VDPA
>> + if (is_mode_vdpa(efx)) {
>> + efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
>> + rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd, inbuf,
>> + inlen, outbuf, outlen, outlen_actual,
>> + true, &raw_rc);
>> + } else {
>> +#endif
>> + rc = _efx_mcdi_rpc(efx, efx->client_id, cmd, inbuf,
>> + inlen, outbuf, outlen, outlen_actual, true,
>> + &raw_rc);
>> +#ifdef CONFIG_SFC_VDPA
>> + }
>> +#endif
>>
>> if ((rc == -EPROTO) && (raw_rc == MC_CMD_ERR_NO_EVB_PORT) &&
>> efx->type->is_vf) {
>> @@ -881,9 +941,22 @@ static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
>>
>> do {
>> usleep_range(delay_us, delay_us + 10000);
>> - rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
>> - outbuf, outlen, outlen_actual,
>> - true, &raw_rc);
>> +#ifdef CONFIG_SFC_VDPA
>> + if (is_mode_vdpa(efx)) {
>> + efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
>> + rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd,
>> + inbuf, inlen, outbuf, outlen,
>> + outlen_actual, true,
>> + &raw_rc);
>> + } else {
>> +#endif
>> + rc = _efx_mcdi_rpc(efx, efx->client_id,
>> + cmd, inbuf, inlen, outbuf,
>> + outlen, outlen_actual, true,
>> + &raw_rc);
>> +#ifdef CONFIG_SFC_VDPA
>> + }
>> +#endif
>> if (delay_us < 100000)
>> delay_us <<= 1;
>> } while ((rc == -EPROTO) &&
>> @@ -939,7 +1012,7 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
>> * function and is then responsible for calling efx_mcdi_display_error
>> * as needed.
>> */
>> -int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
>> +int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned int cmd,
>> const efx_dword_t *inbuf, size_t inlen,
>> efx_dword_t *outbuf, size_t outlen,
>> size_t *outlen_actual)
>> @@ -948,7 +1021,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
>> outlen_actual, true);
>> }
>>
>> -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
>> +int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
>> const efx_dword_t *inbuf, size_t inlen)
>> {
>> struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
>> @@ -965,7 +1038,7 @@ int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
>> return -ENETDOWN;
>>
>> efx_mcdi_acquire_sync(mcdi);
>> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
>> + efx_mcdi_send_request(efx, client_id, cmd, inbuf, inlen);
>> return 0;
>> }
>>
>> @@ -1009,7 +1082,8 @@ static int _efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd,
>> */
>> if (mcdi->async_list.next == &async->list &&
>> efx_mcdi_acquire_async(mcdi)) {
>> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
>> + efx_mcdi_send_request(efx, efx->client_id,
>> + cmd, inbuf, inlen);
>> mod_timer(&mcdi->async_timer,
>> jiffies + MCDI_RPC_TIMEOUT);
>> }
>> diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
>> index dafab52aaef7..2c526d2edeb6 100644
>> --- a/drivers/net/ethernet/sfc/mcdi.h
>> +++ b/drivers/net/ethernet/sfc/mcdi.h
>> @@ -150,7 +150,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
>> efx_dword_t *outbuf, size_t outlen,
>> size_t *outlen_actual);
>>
>> -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
>> +int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
>> const efx_dword_t *inbuf, size_t inlen);
>> int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
>> efx_dword_t *outbuf, size_t outlen,
>> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
>> index 1da71deac71c..948c7a06403a 100644
>> --- a/drivers/net/ethernet/sfc/net_driver.h
>> +++ b/drivers/net/ethernet/sfc/net_driver.h
>> @@ -859,6 +859,7 @@ struct efx_mae;
>> * @secondary_list: List of &struct efx_nic instances for the secondary PCI
>> * functions of the controller, if this is for the primary function.
>> * Serialised by rtnl_lock.
>> + * @client_id: client ID of this PCIe function
>> * @type: Controller type attributes
>> * @legacy_irq: IRQ number
>> * @workqueue: Workqueue for port reconfigures and the HW monitor.
>> @@ -1022,6 +1023,7 @@ struct efx_nic {
>> struct list_head secondary_list;
>> struct pci_dev *pci_dev;
>> unsigned int port_num;
>> + u32 client_id;
>> const struct efx_nic_type *type;
>> int legacy_irq;
>> bool eeh_disabled_legacy_irq;
>> diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
>> index 9f07e1ba7780..d90d4f6b3824 100644
>> --- a/drivers/net/ethernet/sfc/ptp.c
>> +++ b/drivers/net/ethernet/sfc/ptp.c
>> @@ -1052,8 +1052,8 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
>>
>> /* Clear flag that signals MC ready */
>> WRITE_ONCE(*start, 0);
>> - rc = efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf,
>> - MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
>> + rc = efx_mcdi_rpc_start(efx, MC_CMD_CLIENT_ID_SELF, MC_CMD_PTP,
>> + synch_buf, MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
>> EFX_WARN_ON_ONCE_PARANOID(rc);
>>
>> /* Wait for start from MCDI (or timeout) */
>> --
>> 2.30.1
>>

2023-03-13 09:20:19

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 10/14] sfc: implement filters for receiving traffic


On 3/10/23 10:35, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]> wrote:
>> Implement unicast, broadcast and unknown multicast
>> filters for receiving different types of traffic.
>>
>> Signed-off-by: Gautam Dawar <[email protected]>
>> ---
>> drivers/net/ethernet/sfc/ef100_vdpa.c | 157 ++++++++++++++++++++++
>> drivers/net/ethernet/sfc/ef100_vdpa.h | 36 ++++-
>> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 17 ++-
>> 3 files changed, 207 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> index 4ba57827a6cd..5c9f29f881a6 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> @@ -16,12 +16,166 @@
>> #include "mcdi_filters.h"
>> #include "mcdi_functions.h"
>> #include "ef100_netdev.h"
>> +#include "filter.h"
>> +#include "efx.h"
>>
>> +#define EFX_INVALID_FILTER_ID -1
>> +
>> +/* vDPA queues starts from 2nd VI or qid 1 */
>> +#define EF100_VDPA_BASE_RX_QID 1
>> +
>> +static const char * const filter_names[] = { "bcast", "ucast", "mcast" };
>> static struct virtio_device_id ef100_vdpa_id_table[] = {
>> { .device = VIRTIO_ID_NET, .vendor = PCI_VENDOR_ID_REDHAT_QUMRANET },
>> { 0 },
>> };
>>
>> +static int ef100_vdpa_set_mac_filter(struct efx_nic *efx,
>> + struct efx_filter_spec *spec,
>> + u32 qid, u8 *mac_addr)
>> +{
>> + int rc;
>> +
>> + efx_filter_init_rx(spec, EFX_FILTER_PRI_AUTO, 0, qid);
>> +
>> + if (mac_addr) {
>> + rc = efx_filter_set_eth_local(spec, EFX_FILTER_VID_UNSPEC,
>> + mac_addr);
>> + if (rc)
>> + pci_err(efx->pci_dev,
>> + "Filter set eth local failed, err: %d\n", rc);
>> + } else {
>> + efx_filter_set_mc_def(spec);
>> + }
>> +
>> + rc = efx_filter_insert_filter(efx, spec, true);
>> + if (rc < 0)
>> + pci_err(efx->pci_dev,
>> + "Filter insert failed, err: %d\n", rc);
>> +
>> + return rc;
>> +}
>> +
>> +static int ef100_vdpa_delete_filter(struct ef100_vdpa_nic *vdpa_nic,
>> + enum ef100_vdpa_mac_filter_type type)
>> +{
>> + struct vdpa_device *vdev = &vdpa_nic->vdpa_dev;
>> + int rc;
>> +
>> + if (vdpa_nic->filters[type].filter_id == EFX_INVALID_FILTER_ID)
>> + return rc;
>> +
>> + rc = efx_filter_remove_id_safe(vdpa_nic->efx,
>> + EFX_FILTER_PRI_AUTO,
>> + vdpa_nic->filters[type].filter_id);
>> + if (rc) {
>> + dev_err(&vdev->dev, "%s filter id: %d remove failed, err: %d\n",
>> + filter_names[type], vdpa_nic->filters[type].filter_id,
>> + rc);
>> + } else {
>> + vdpa_nic->filters[type].filter_id = EFX_INVALID_FILTER_ID;
>> + vdpa_nic->filter_cnt--;
>> + }
>> + return rc;
>> +}
>> +
>> +int ef100_vdpa_add_filter(struct ef100_vdpa_nic *vdpa_nic,
>> + enum ef100_vdpa_mac_filter_type type)
>> +{
>> + struct vdpa_device *vdev = &vdpa_nic->vdpa_dev;
>> + struct efx_nic *efx = vdpa_nic->efx;
>> + /* Configure filter on base Rx queue only */
>> + u32 qid = EF100_VDPA_BASE_RX_QID;
>> + struct efx_filter_spec *spec;
>> + u8 baddr[ETH_ALEN];
>> + int rc;
>> +
>> + /* remove existing filter */
>> + rc = ef100_vdpa_delete_filter(vdpa_nic, type);
>> + if (rc < 0) {
>> + dev_err(&vdev->dev, "%s MAC filter deletion failed, err: %d",
>> + filter_names[type], rc);
>> + return rc;
>> + }
>> +
>> + /* Configure MAC Filter */
>> + spec = &vdpa_nic->filters[type].spec;
>> + if (type == EF100_VDPA_BCAST_MAC_FILTER) {
>> + eth_broadcast_addr(baddr);
>> + rc = ef100_vdpa_set_mac_filter(efx, spec, qid, baddr);
>> + } else if (type == EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER) {
>> + rc = ef100_vdpa_set_mac_filter(efx, spec, qid, NULL);
>> + } else {
>> + /* Ensure we have a valid mac address */
>> + if (!vdpa_nic->mac_configured ||
>> + !is_valid_ether_addr(vdpa_nic->mac_address))
>> + return -EINVAL;
>> +
>> + rc = ef100_vdpa_set_mac_filter(efx, spec, qid,
>> + vdpa_nic->mac_address);
>> + }
>> +
>> + if (rc >= 0) {
>> + vdpa_nic->filters[type].filter_id = rc;
>> + vdpa_nic->filter_cnt++;
>> +
>> + return 0;
>> + }
>> +
>> + dev_err(&vdev->dev, "%s MAC filter insert failed, err: %d\n",
>> + filter_names[type], rc);
>> +
>> + if (type != EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER) {
>> + ef100_vdpa_filter_remove(vdpa_nic);
>> + return rc;
>> + }
>> +
>> + return 0;
>> +}
>> +
>> +int ef100_vdpa_filter_remove(struct ef100_vdpa_nic *vdpa_nic)
>> +{
>> + enum ef100_vdpa_mac_filter_type filter;
>> + int err = 0;
>> + int rc;
>> +
>> + for (filter = EF100_VDPA_BCAST_MAC_FILTER;
>> + filter <= EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER; filter++) {
>> + rc = ef100_vdpa_delete_filter(vdpa_nic, filter);
>> + if (rc < 0)
>> + /* store status of last failed filter remove */
>> + err = rc;
>> + }
>> + return err;
>> +}
>> +
>> +int ef100_vdpa_filter_configure(struct ef100_vdpa_nic *vdpa_nic)
>> +{
>> + struct vdpa_device *vdev = &vdpa_nic->vdpa_dev;
>> + enum ef100_vdpa_mac_filter_type filter;
>> + int rc;
>> +
>> + /* remove existing filters, if any */
>> + rc = ef100_vdpa_filter_remove(vdpa_nic);
>> + if (rc < 0) {
>> + dev_err(&vdev->dev,
>> + "MAC filter deletion failed, err: %d", rc);
>> + goto fail;
>> + }
>> +
>> + for (filter = EF100_VDPA_BCAST_MAC_FILTER;
>> + filter <= EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER; filter++) {
>> + if (filter == EF100_VDPA_UCAST_MAC_FILTER &&
>> + !vdpa_nic->mac_configured)
>> + continue;
> Nit: is this better to move this inside ef100_vdpa_add_filter()?
In fact, this check is already part of ef100_vdpa_add_filter() and is
duplicated here. Will fix.
>
>> + rc = ef100_vdpa_add_filter(vdpa_nic, filter);
>> + if (rc < 0)
>> + goto fail;
>> + }
>> +fail:
>> + return rc;
>> +}
>> +
>> int ef100_vdpa_init(struct efx_probe_data *probe_data)
>> {
>> struct efx_nic *efx = &probe_data->efx;
>> @@ -185,6 +339,9 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> goto err_put_device;
>> }
>>
>> + for (i = 0; i < EF100_VDPA_MAC_FILTER_NTYPES; i++)
>> + vdpa_nic->filters[i].filter_id = EFX_INVALID_FILTER_ID;
>> +
>> rc = get_net_config(vdpa_nic);
>> if (rc)
>> goto err_put_device;
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> index 58791402e454..49fb6be04eb3 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> @@ -72,6 +72,22 @@ enum ef100_vdpa_vq_type {
>> EF100_VDPA_VQ_NTYPES
>> };
>>
>> +/**
>> + * enum ef100_vdpa_mac_filter_type - vdpa filter types
>> + *
>> + * @EF100_VDPA_BCAST_MAC_FILTER: Broadcast MAC filter
>> + * @EF100_VDPA_UCAST_MAC_FILTER: Unicast MAC filter
>> + * @EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER: Unknown multicast MAC filter to allow
>> + * IPv6 Neighbor Solicitation Message
>> + * @EF100_VDPA_MAC_FILTER_NTYPES: Number of vDPA filter types
>> + */
>> +enum ef100_vdpa_mac_filter_type {
>> + EF100_VDPA_BCAST_MAC_FILTER,
>> + EF100_VDPA_UCAST_MAC_FILTER,
>> + EF100_VDPA_UNKNOWN_MCAST_MAC_FILTER,
>> + EF100_VDPA_MAC_FILTER_NTYPES,
>> +};
>> +
>> /**
>> * struct ef100_vdpa_vring_info - vDPA vring data structure
>> *
>> @@ -107,6 +123,17 @@ struct ef100_vdpa_vring_info {
>> struct vdpa_callback cb;
>> };
>>
>> +/**
>> + * struct ef100_vdpa_filter - vDPA filter data structure
>> + *
>> + * @filter_id: filter id of this filter
>> + * @efx_filter_spec: hardware filter specs for this vdpa device
>> + */
>> +struct ef100_vdpa_filter {
>> + s32 filter_id;
>> + struct efx_filter_spec spec;
>> +};
>> +
>> /**
>> * struct ef100_vdpa_nic - vDPA NIC data structure
>> *
>> @@ -116,6 +143,7 @@ struct ef100_vdpa_vring_info {
>> * @lock: Managing access to vdpa config operations
>> * @pf_index: PF index of the vDPA VF
>> * @vf_index: VF index of the vDPA VF
>> + * @filter_cnt: total number of filters created on this vdpa device
>> * @status: device status as per VIRTIO spec
>> * @features: negotiated feature bits
>> * @max_queue_pairs: maximum number of queue pairs supported
>> @@ -123,6 +151,7 @@ struct ef100_vdpa_vring_info {
>> * @vring: vring information of the vDPA device.
>> * @mac_address: mac address of interface associated with this vdpa device
>> * @mac_configured: true after MAC address is configured
>> + * @filters: details of all filters created on this vdpa device
>> * @cfg_cb: callback for config change
>> */
>> struct ef100_vdpa_nic {
>> @@ -133,6 +162,7 @@ struct ef100_vdpa_nic {
>> struct mutex lock;
>> u32 pf_index;
>> u32 vf_index;
>> + u32 filter_cnt;
>> u8 status;
>> u64 features;
>> u32 max_queue_pairs;
>> @@ -140,6 +170,7 @@ struct ef100_vdpa_nic {
>> struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
>> u8 *mac_address;
>> bool mac_configured;
>> + struct ef100_vdpa_filter filters[EF100_VDPA_MAC_FILTER_NTYPES];
>> struct vdpa_callback cfg_cb;
>> };
>>
>> @@ -147,7 +178,10 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data);
>> void ef100_vdpa_fini(struct efx_probe_data *probe_data);
>> int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
>> void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
>> -void ef100_vdpa_irq_vectors_free(void *data);
>> +int ef100_vdpa_filter_configure(struct ef100_vdpa_nic *vdpa_nic);
>> +int ef100_vdpa_filter_remove(struct ef100_vdpa_nic *vdpa_nic);
>> +int ef100_vdpa_add_filter(struct ef100_vdpa_nic *vdpa_nic,
>> + enum ef100_vdpa_mac_filter_type type);
>> int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>> void ef100_vdpa_irq_vectors_free(void *data);
>> int ef100_vdpa_reset(struct vdpa_device *vdev);
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> index 95a2177f85a2..db86c2693950 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> @@ -261,6 +261,7 @@ static void ef100_reset_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>> vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
>> vdpa_nic->status = 0;
>> vdpa_nic->features = 0;
>> + ef100_vdpa_filter_remove(vdpa_nic);
>> for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++)
>> reset_vring(vdpa_nic, i);
>> ef100_vdpa_irq_vectors_free(vdpa_nic->efx->pci_dev);
>> @@ -295,7 +296,7 @@ static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>> rc = ef100_vdpa_irq_vectors_alloc(efx->pci_dev,
>> vdpa_nic->max_queue_pairs * 2);
>> if (rc < 0) {
>> - pci_err(efx->pci_dev,
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
> This should be done in the previous patch.
Right. Will fix.
>
> Thanks
>
>
>> "vDPA IRQ alloc failed for vf: %u err:%d\n",
>> nic_data->vf_index, rc);
>> return rc;
>> @@ -309,9 +310,19 @@ static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>> }
>> }
>>
>> + rc = ef100_vdpa_filter_configure(vdpa_nic);
>> + if (rc < 0) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: vdpa configure filter failed, err: %d\n",
>> + __func__, rc);
>> + goto err_filter_configure;
>> + }
>> +
>> vdpa_nic->vdpa_state = EF100_VDPA_STATE_STARTED;
>> return 0;
>>
>> +err_filter_configure:
>> + ef100_vdpa_filter_remove(vdpa_nic);
>> clear_vring:
>> for (j = 0; j < i; j++)
>> delete_vring(vdpa_nic, j);
>> @@ -680,8 +691,10 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
>> }
>>
>> memcpy((u8 *)&vdpa_nic->net_config + offset, buf, len);
>> - if (is_valid_ether_addr(vdpa_nic->mac_address))
>> + if (is_valid_ether_addr(vdpa_nic->mac_address)) {
>> vdpa_nic->mac_configured = true;
>> + ef100_vdpa_add_filter(vdpa_nic, EF100_VDPA_UCAST_MAC_FILTER);
>> + }
>> }
>>
>> static int ef100_vdpa_suspend(struct vdpa_device *vdev)
>> --
>> 2.30.1
>>

2023-03-13 11:51:00

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 01/14] sfc: add function personality support for EF100 devices

On Fri, Mar 10, 2023 at 01:04:14PM +0800, Jason Wang wrote:
> On Tue, Mar 7, 2023 at 7:36 PM Gautam Dawar <[email protected]> wrote:
> >
> > A function personality defines the location and semantics of
> > registers in the BAR. EF100 NICs allow different personalities
> > of a PCIe function and changing it at run-time. A total of three
> > function personalities are defined as of now: EF100, vDPA and
> > None with EF100 being the default.
> > For now, vDPA net devices can be created on a EF100 virtual
> > function and the VF personality will be changed to vDPA in the
> > process.
> >
> > Co-developed-by: Martin Habets <[email protected]>
> > Signed-off-by: Martin Habets <[email protected]>
> > Signed-off-by: Gautam Dawar <[email protected]>
> > ---
> > drivers/net/ethernet/sfc/ef100.c | 6 +-
> > drivers/net/ethernet/sfc/ef100_nic.c | 98 +++++++++++++++++++++++++++-
> > drivers/net/ethernet/sfc/ef100_nic.h | 11 ++++
> > 3 files changed, 111 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
> > index 71aab3d0480f..c1c69783db7b 100644
> > --- a/drivers/net/ethernet/sfc/ef100.c
> > +++ b/drivers/net/ethernet/sfc/ef100.c
> > @@ -429,8 +429,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
> > if (!efx)
> > return;
> >
> > - probe_data = container_of(efx, struct efx_probe_data, efx);
> > - ef100_remove_netdev(probe_data);
> > + efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_NONE);
> > #ifdef CONFIG_SFC_SRIOV
> > efx_fini_struct_tc(efx);
> > #endif
> > @@ -443,6 +442,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
> > pci_disable_pcie_error_reporting(pci_dev);
> >
> > pci_set_drvdata(pci_dev, NULL);
> > + probe_data = container_of(efx, struct efx_probe_data, efx);
> > efx_fini_struct(efx);
> > kfree(probe_data);
> > };
> > @@ -508,7 +508,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
> > goto fail;
> >
> > efx->state = STATE_PROBED;
> > - rc = ef100_probe_netdev(probe_data);
> > + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
> > if (rc)
> > goto fail;
> >
> > diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> > index 4dc643b0d2db..8cbe5e0f4bdf 100644
> > --- a/drivers/net/ethernet/sfc/ef100_nic.c
> > +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> > @@ -772,6 +772,99 @@ static int efx_ef100_get_base_mport(struct efx_nic *efx)
> > return 0;
> > }
> >
> > +/* BAR configuration.
> > + * To change BAR configuration, tear down the current configuration (which
> > + * leaves the hardware in the PROBED state), and then initialise the new
> > + * BAR state.
> > + */
> > +struct ef100_bar_config_ops {
> > + int (*init)(struct efx_probe_data *probe_data);
> > + void (*fini)(struct efx_probe_data *probe_data);
> > +};
> > +
> > +static const struct ef100_bar_config_ops bar_config_ops[] = {
> > + [EF100_BAR_CONFIG_EF100] = {
> > + .init = ef100_probe_netdev,
> > + .fini = ef100_remove_netdev
> > + },
> > +#ifdef CONFIG_SFC_VDPA
> > + [EF100_BAR_CONFIG_VDPA] = {
> > + .init = NULL,
> > + .fini = NULL
> > + },
> > +#endif
> > + [EF100_BAR_CONFIG_NONE] = {
> > + .init = NULL,
> > + .fini = NULL
> > + },
> > +};
>
> This looks more like a mini bus implementation. I wonder if we can
> reuse an auxiliary bus here which is more user friendly for management
> tools.

When we were in the design phase of vDPA for EF100 it was still called
virtbus, and the virtbus discussion was in full swing at that time.
We could not afford to add risk to the project by depending on it, as
it might not have been merged at all.
If we were doing the same design now I would definitely consider using
the auxiliary bus.

Martin

2023-03-13 12:11:04

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 09/14] sfc: implement device status related vdpa config operations


On 3/10/23 10:35, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]> wrote:
>> vDPA config opertions to handle get/set device status and device
>> reset have been implemented. Also .suspend config operation is
>> implemented to support Live Migration.
>>
>> Signed-off-by: Gautam Dawar <[email protected]>
>> ---
>> drivers/net/ethernet/sfc/ef100_vdpa.c | 16 +-
>> drivers/net/ethernet/sfc/ef100_vdpa.h | 2 +
>> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 367 ++++++++++++++++++++--
>> 3 files changed, 355 insertions(+), 30 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> index c66e5aef69ea..4ba57827a6cd 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> @@ -68,9 +68,14 @@ static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)
>>
>> static void ef100_vdpa_delete(struct efx_nic *efx)
>> {
>> + struct vdpa_device *vdpa_dev;
>> +
>> if (efx->vdpa_nic) {
>> + vdpa_dev = &efx->vdpa_nic->vdpa_dev;
>> + ef100_vdpa_reset(vdpa_dev);
>> +
>> /* replace with _vdpa_unregister_device later */
>> - put_device(&efx->vdpa_nic->vdpa_dev.dev);
>> + put_device(&vdpa_dev->dev);
>> }
>> efx_mcdi_free_vis(efx);
>> }
>> @@ -171,6 +176,15 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> }
>> }
>>
>> + rc = devm_add_action_or_reset(&efx->pci_dev->dev,
>> + ef100_vdpa_irq_vectors_free,
>> + efx->pci_dev);
>> + if (rc) {
>> + pci_err(efx->pci_dev,
>> + "Failed adding devres for freeing irq vectors\n");
>> + goto err_put_device;
>> + }
>> +
>> rc = get_net_config(vdpa_nic);
>> if (rc)
>> goto err_put_device;
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> index 348ca8a7404b..58791402e454 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> @@ -149,6 +149,8 @@ int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
>> void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
>> void ef100_vdpa_irq_vectors_free(void *data);
>> int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>> +void ef100_vdpa_irq_vectors_free(void *data);
>> +int ef100_vdpa_reset(struct vdpa_device *vdev);
>>
>> static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
>> {
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> index 0051c4c0e47c..95a2177f85a2 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> @@ -22,11 +22,6 @@ static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
>> return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
>> }
>>
>> -void ef100_vdpa_irq_vectors_free(void *data)
>> -{
>> - pci_free_irq_vectors(data);
>> -}
>> -
>> static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> {
>> struct efx_vring_ctx *vring_ctx;
>> @@ -52,14 +47,6 @@ static void delete_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> vdpa_nic->vring[idx].vring_ctx = NULL;
>> }
>>
>> -static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> -{
>> - vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>> - vdpa_nic->vring[idx].vring_state = 0;
>> - vdpa_nic->vring[idx].last_avail_idx = 0;
>> - vdpa_nic->vring[idx].last_used_idx = 0;
>> -}
>> -
>> int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> {
>> u32 offset;
>> @@ -103,6 +90,236 @@ static bool is_qid_invalid(struct ef100_vdpa_nic *vdpa_nic, u16 idx,
>> return false;
>> }
>>
>> +static void irq_vring_fini(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
>> + struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
>> +
>> + devm_free_irq(&pci_dev->dev, vring->irq, vring);
>> + vring->irq = -EINVAL;
>> +}
>> +
>> +static irqreturn_t vring_intr_handler(int irq, void *arg)
>> +{
>> + struct ef100_vdpa_vring_info *vring = arg;
>> +
>> + if (vring->cb.callback)
>> + return vring->cb.callback(vring->cb.private);
>> +
>> + return IRQ_NONE;
>> +}
>> +
>> +static int ef100_vdpa_irq_vectors_alloc(struct pci_dev *pci_dev, u16 nvqs)
>> +{
>> + int rc;
>> +
>> + rc = pci_alloc_irq_vectors(pci_dev, nvqs, nvqs, PCI_IRQ_MSIX);
>> + if (rc < 0)
>> + pci_err(pci_dev,
>> + "Failed to alloc %d IRQ vectors, err:%d\n", nvqs, rc);
>> + return rc;
>> +}
>> +
>> +void ef100_vdpa_irq_vectors_free(void *data)
>> +{
>> + pci_free_irq_vectors(data);
>> +}
>> +
>> +static int irq_vring_init(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
>> + struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
>> + int irq;
>> + int rc;
>> +
>> + snprintf(vring->msix_name, 256, "x_vdpa[%s]-%d\n",
>> + pci_name(pci_dev), idx);
>> + irq = pci_irq_vector(pci_dev, idx);
>> + rc = devm_request_irq(&pci_dev->dev, irq, vring_intr_handler, 0,
>> + vring->msix_name, vring);
>> + if (rc)
>> + pci_err(pci_dev,
>> + "devm_request_irq failed for vring %d, rc %d\n",
>> + idx, rc);
>> + else
>> + vring->irq = irq;
>> +
>> + return rc;
>> +}
>> +
>> +static int delete_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + struct efx_vring_dyn_cfg vring_dyn_cfg;
>> + int rc;
>> +
>> + if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>> + return 0;
>> +
>> + rc = efx_vdpa_vring_destroy(vdpa_nic->vring[idx].vring_ctx,
>> + &vring_dyn_cfg);
>> + if (rc)
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: delete vring failed index:%u, err:%d\n",
>> + __func__, idx, rc);
>> + vdpa_nic->vring[idx].last_avail_idx = vring_dyn_cfg.avail_idx;
>> + vdpa_nic->vring[idx].last_used_idx = vring_dyn_cfg.used_idx;
>> + vdpa_nic->vring[idx].vring_state &= ~EF100_VRING_CREATED;
>> +
>> + irq_vring_fini(vdpa_nic, idx);
>> +
>> + return rc;
>> +}
>> +
>> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + u32 idx_val;
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return;
>> +
>> + if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>> + return;
>> +
>> + idx_val = idx;
>> + _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>> + vdpa_nic->vring[idx].doorbell_offset);
>> +}
>> +
>> +static bool can_create_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + if (vdpa_nic->vring[idx].vring_state == EF100_VRING_CONFIGURED &&
>> + vdpa_nic->status & VIRTIO_CONFIG_S_DRIVER_OK &&
>> + !(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>> + return true;
>> +
>> + return false;
>> +}
>> +
>> +static int create_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + struct efx_vring_dyn_cfg vring_dyn_cfg;
>> + struct efx_vring_cfg vring_cfg;
>> + int rc;
>> +
>> + rc = irq_vring_init(vdpa_nic, idx);
>> + if (rc) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: irq_vring_init failed. index:%u, err:%d\n",
>> + __func__, idx, rc);
>> + return rc;
>> + }
>> + vring_cfg.desc = vdpa_nic->vring[idx].desc;
>> + vring_cfg.avail = vdpa_nic->vring[idx].avail;
>> + vring_cfg.used = vdpa_nic->vring[idx].used;
>> + vring_cfg.size = vdpa_nic->vring[idx].size;
>> + vring_cfg.features = vdpa_nic->features;
>> + vring_cfg.msix_vector = idx;
>> + vring_dyn_cfg.avail_idx = vdpa_nic->vring[idx].last_avail_idx;
>> + vring_dyn_cfg.used_idx = vdpa_nic->vring[idx].last_used_idx;
>> +
>> + rc = efx_vdpa_vring_create(vdpa_nic->vring[idx].vring_ctx,
>> + &vring_cfg, &vring_dyn_cfg);
>> + if (rc) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: vring_create failed index:%u, err:%d\n",
>> + __func__, idx, rc);
>> + goto err_vring_create;
>> + }
>> + vdpa_nic->vring[idx].vring_state |= EF100_VRING_CREATED;
>> +
>> + /* A VQ kick allows the device to read the avail_idx, which will be
>> + * required at the destination after live migration.
>> + */
>> + ef100_vdpa_kick_vq(&vdpa_nic->vdpa_dev, idx);
>> +
>> + return 0;
>> +
>> +err_vring_create:
>> + irq_vring_fini(vdpa_nic, idx);
>> + return rc;
>> +}
>> +
>> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + delete_vring(vdpa_nic, idx);
>> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>> + vdpa_nic->vring[idx].vring_state = 0;
>> + vdpa_nic->vring[idx].last_avail_idx = 0;
>> + vdpa_nic->vring[idx].last_used_idx = 0;
>> +}
>> +
>> +static void ef100_reset_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>> +{
>> + int i;
>> +
>> + WARN_ON(!mutex_is_locked(&vdpa_nic->lock));
>> +
>> + if (!vdpa_nic->status)
>> + return;
>> +
>> + vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
>> + vdpa_nic->status = 0;
>> + vdpa_nic->features = 0;
>> + for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++)
>> + reset_vring(vdpa_nic, i);
>> + ef100_vdpa_irq_vectors_free(vdpa_nic->efx->pci_dev);
>> +}
>> +
>> +/* May be called under the rtnl lock */
>> +int ef100_vdpa_reset(struct vdpa_device *vdev)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + /* vdpa device can be deleted anytime but the bar_config
>> + * could still be vdpa and hence efx->state would be STATE_VDPA.
>> + * Accordingly, ensure vdpa device exists before reset handling
>> + */
>> + if (!vdpa_nic)
>> + return -ENODEV;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + ef100_reset_vdpa_device(vdpa_nic);
>> + mutex_unlock(&vdpa_nic->lock);
>> + return 0;
>> +}
>> +
>> +static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>> +{
>> + struct efx_nic *efx = vdpa_nic->efx;
>> + struct ef100_nic_data *nic_data;
>> + int i, j;
>> + int rc;
>> +
>> + nic_data = efx->nic_data;
>> + rc = ef100_vdpa_irq_vectors_alloc(efx->pci_dev,
>> + vdpa_nic->max_queue_pairs * 2);
>> + if (rc < 0) {
>> + pci_err(efx->pci_dev,
>> + "vDPA IRQ alloc failed for vf: %u err:%d\n",
>> + nic_data->vf_index, rc);
>> + return rc;
>> + }
>> +
>> + for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>> + if (can_create_vring(vdpa_nic, i)) {
>> + rc = create_vring(vdpa_nic, i);
>> + if (rc)
>> + goto clear_vring;
>> + }
>> + }
>> +
>> + vdpa_nic->vdpa_state = EF100_VDPA_STATE_STARTED;
> It looks to me that this duplicates with the DRIVER_OK status bit.
vdpa_state is set EF100_VDPA_STATE_STARTED during DRIVER_OK handling.
See my later response for its purpose.
>
>> + return 0;
>> +
>> +clear_vring:
>> + for (j = 0; j < i; j++)
>> + delete_vring(vdpa_nic, j);
>> +
>> + ef100_vdpa_irq_vectors_free(efx->pci_dev);
>> + return rc;
>> +}
>> +
>> static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
>> u16 idx, u64 desc_area, u64 driver_area,
>> u64 device_area)
>> @@ -144,22 +361,6 @@ static void ef100_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
>> mutex_unlock(&vdpa_nic->lock);
>> }
>>
>> -static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>> -{
>> - struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> - u32 idx_val;
>> -
>> - if (is_qid_invalid(vdpa_nic, idx, __func__))
>> - return;
>> -
>> - if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>> - return;
>> -
>> - idx_val = idx;
>> - _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>> - vdpa_nic->vring[idx].doorbell_offset);
>> -}
>> -
>> static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
>> struct vdpa_callback *cb)
>> {
>> @@ -176,6 +377,7 @@ static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
>> bool ready)
>> {
>> struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + int rc;
>>
>> if (is_qid_invalid(vdpa_nic, idx, __func__))
>> return;
>> @@ -184,9 +386,21 @@ static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
>> if (ready) {
>> vdpa_nic->vring[idx].vring_state |=
>> EF100_VRING_READY_CONFIGURED;
>> + if (vdpa_nic->vdpa_state == EF100_VDPA_STATE_STARTED &&
>> + can_create_vring(vdpa_nic, idx)) {
>> + rc = create_vring(vdpa_nic, idx);
>> + if (rc)
>> + /* Rollback ready configuration
>> + * So that the above layer driver
>> + * can make another attempt to set ready
>> + */
>> + vdpa_nic->vring[idx].vring_state &=
>> + ~EF100_VRING_READY_CONFIGURED;
>> + }
>> } else {
>> vdpa_nic->vring[idx].vring_state &=
>> ~EF100_VRING_READY_CONFIGURED;
>> + delete_vring(vdpa_nic, idx);
>> }
>> mutex_unlock(&vdpa_nic->lock);
>> }
>> @@ -296,6 +510,12 @@ static u64 ef100_vdpa_get_device_features(struct vdpa_device *vdev)
>> }
>>
>> features |= BIT_ULL(VIRTIO_NET_F_MAC);
>> + /* As QEMU SVQ doesn't implement the following features,
>> + * masking them off to allow Live Migration
>> + */
>> + features &= ~BIT_ULL(VIRTIO_F_IN_ORDER);
>> + features &= ~BIT_ULL(VIRTIO_F_ORDER_PLATFORM);
> It's better not to work around userspace bugs in the kernel. We should
> fix Qemu instead.

There's already a QEMU patch [1] submitted to support
VIRTIO_F_ORDER_PLATFORM but it hasn't concluded yet. Also, there is no
support for VIRTIO_F_IN_ORDER in the kernel virtio driver. The motive of
this change is to have VM Live Migration working with the kernel in-tree
driver without requiring any changes.

Once QEMU is able to handle these features, we can submit a patch to
undo these changes.

>
>> +
>> return features;
>> }
>>
>> @@ -356,6 +576,77 @@ static u32 ef100_vdpa_get_vendor_id(struct vdpa_device *vdev)
>> return EF100_VDPA_VENDOR_ID;
>> }
>>
>> +static u8 ef100_vdpa_get_status(struct vdpa_device *vdev)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + u8 status;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + status = vdpa_nic->status;
>> + mutex_unlock(&vdpa_nic->lock);
>> + return status;
>> +}
>> +
>> +static void ef100_vdpa_set_status(struct vdpa_device *vdev, u8 status)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + u8 new_status;
>> + int rc;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + if (!status) {
>> + dev_info(&vdev->dev,
>> + "%s: Status received is 0. Device reset being done\n",
>> + __func__);
> This is trigger-able by the userspace. It might be better to use
> dev_dbg() instead.
Will change.
>
>> + ef100_reset_vdpa_device(vdpa_nic);
>> + goto unlock_return;
>> + }
>> + new_status = status & ~vdpa_nic->status;
>> + if (new_status == 0) {
>> + dev_info(&vdev->dev,
>> + "%s: New status same as current status\n", __func__);
> Same here.
Ok.
>
>> + goto unlock_return;
>> + }
>> + if (new_status & VIRTIO_CONFIG_S_FAILED) {
>> + ef100_reset_vdpa_device(vdpa_nic);
>> + goto unlock_return;
>> + }
>> +
>> + if (new_status & VIRTIO_CONFIG_S_ACKNOWLEDGE) {
>> + vdpa_nic->status |= VIRTIO_CONFIG_S_ACKNOWLEDGE;
>> + new_status &= ~VIRTIO_CONFIG_S_ACKNOWLEDGE;
>> + }
>> + if (new_status & VIRTIO_CONFIG_S_DRIVER) {
>> + vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER;
>> + new_status &= ~VIRTIO_CONFIG_S_DRIVER;
>> + }
>> + if (new_status & VIRTIO_CONFIG_S_FEATURES_OK) {
>> + vdpa_nic->status |= VIRTIO_CONFIG_S_FEATURES_OK;
>> + vdpa_nic->vdpa_state = EF100_VDPA_STATE_NEGOTIATED;
> It might be better to explain the reason we need to track another
> state in vdpa_state instead of simply using the device status.
vdpa_state helps to ensure correct status transitions in the .set_status
callback and safe-guards against incorrect/malicious user-space driver.
>
>> + new_status &= ~VIRTIO_CONFIG_S_FEATURES_OK;
>> + }
>> + if (new_status & VIRTIO_CONFIG_S_DRIVER_OK &&
>> + vdpa_nic->vdpa_state == EF100_VDPA_STATE_NEGOTIATED) {
>> + vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER_OK;
>> + rc = start_vdpa_device(vdpa_nic);
>> + if (rc) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: vDPA device failed:%d\n", __func__, rc);
>> + vdpa_nic->status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
>> + goto unlock_return;
>> + }
>> + new_status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
>> + }
>> + if (new_status) {
>> + dev_warn(&vdev->dev,
>> + "%s: Mismatch Status: %x & State: %u\n",
>> + __func__, new_status, vdpa_nic->vdpa_state);
>> + }
>> +
>> +unlock_return:
>> + mutex_unlock(&vdpa_nic->lock);
>> +}
>> +
>> static size_t ef100_vdpa_get_config_size(struct vdpa_device *vdev)
>> {
>> return sizeof(struct virtio_net_config);
>> @@ -393,6 +684,20 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
>> vdpa_nic->mac_configured = true;
>> }
>>
>> +static int ef100_vdpa_suspend(struct vdpa_device *vdev)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + int i, rc;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>> + rc = delete_vring(vdpa_nic, i);
> Note that the suspension matters for the whole device. It means the
> config space should not be changed. But the code here only suspends
> the vring, is this intende/d?
Are you referring to the possibility of updating device configuration
(eg. MAC address) using .set_config() after suspend operation? Is there
any other user triggered operation that falls in this category?
>
> Reset may have the same issue.
Could you pls elaborate on the requirement during device reset?
>
> Thanks
[1] https://patchew.org/QEMU/[email protected]/
>
>> + if (rc)
>> + break;
>> + }
>> + mutex_unlock(&vdpa_nic->lock);
>> + return rc;
>> +}
>> static void ef100_vdpa_free(struct vdpa_device *vdev)
>> {
>> struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> @@ -428,9 +733,13 @@ const struct vdpa_config_ops ef100_vdpa_config_ops = {
>> .get_vq_num_max = ef100_vdpa_get_vq_num_max,
>> .get_device_id = ef100_vdpa_get_device_id,
>> .get_vendor_id = ef100_vdpa_get_vendor_id,
>> + .get_status = ef100_vdpa_get_status,
>> + .set_status = ef100_vdpa_set_status,
>> + .reset = ef100_vdpa_reset,
>> .get_config_size = ef100_vdpa_get_config_size,
>> .get_config = ef100_vdpa_get_config,
>> .set_config = ef100_vdpa_set_config,
>> .get_generation = NULL,
>> + .suspend = ef100_vdpa_suspend,
>> .free = ef100_vdpa_free,
>> };
>> --
>> 2.30.1
>>

2023-03-13 12:34:42

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 08/14] sfc: implement vdpa vring config operations


On 3/10/23 10:34, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 7, 2023 at 7:37 PM Gautam Dawar <[email protected]> wrote:
>> This patch implements the vDPA config operations related to
>> virtqueues or vrings. These include setting vring address,
>> getting vq state, operations to enable/disable a vq etc.
>> The resources required for vring operations eg. VI, interrupts etc.
>> are also allocated.
>>
>> Signed-off-by: Gautam Dawar <[email protected]>
>> ---
>> drivers/net/ethernet/sfc/ef100_vdpa.c | 46 +++-
>> drivers/net/ethernet/sfc/ef100_vdpa.h | 54 +++++
>> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 275 ++++++++++++++++++++++
>> 3 files changed, 374 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> index 4c5a98c9d6c3..c66e5aef69ea 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> @@ -14,6 +14,7 @@
>> #include "ef100_vdpa.h"
>> #include "mcdi_vdpa.h"
>> #include "mcdi_filters.h"
>> +#include "mcdi_functions.h"
>> #include "ef100_netdev.h"
>>
>> static struct virtio_device_id ef100_vdpa_id_table[] = {
>> @@ -47,12 +48,31 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data)
>> return rc;
>> }
>>
>> +static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)
>> +{
>> + /* The first VI is reserved for MCDI
>> + * 1 VI each for rx + tx ring
>> + */
>> + unsigned int max_vis = 1 + EF100_VDPA_MAX_QUEUES_PAIRS;
>> + unsigned int min_vis = 1 + 1;
>> + int rc;
>> +
>> + rc = efx_mcdi_alloc_vis(efx, min_vis, max_vis,
>> + NULL, allocated_vis);
>> + if (!rc)
>> + return rc;
>> + if (*allocated_vis < min_vis)
>> + return -ENOSPC;
>> + return 0;
>> +}
>> +
>> static void ef100_vdpa_delete(struct efx_nic *efx)
>> {
>> if (efx->vdpa_nic) {
>> /* replace with _vdpa_unregister_device later */
>> put_device(&efx->vdpa_nic->vdpa_dev.dev);
>> }
>> + efx_mcdi_free_vis(efx);
>> }
>>
>> void ef100_vdpa_fini(struct efx_probe_data *probe_data)
>> @@ -104,9 +124,19 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> {
>> struct ef100_nic_data *nic_data = efx->nic_data;
>> struct ef100_vdpa_nic *vdpa_nic;
>> + unsigned int allocated_vis;
>> int rc;
>> + u8 i;
>>
>> nic_data->vdpa_class = dev_type;
>> + rc = vdpa_allocate_vis(efx, &allocated_vis);
>> + if (rc) {
>> + pci_err(efx->pci_dev,
>> + "%s Alloc VIs failed for vf:%u error:%d\n",
>> + __func__, nic_data->vf_index, rc);
>> + return ERR_PTR(rc);
>> + }
>> +
>> vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
>> vdpa_dev, &efx->pci_dev->dev,
>> &ef100_vdpa_config_ops,
>> @@ -117,7 +147,8 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> "vDPA device allocation failed for vf: %u\n",
>> nic_data->vf_index);
>> nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
>> - return ERR_PTR(-ENOMEM);
>> + rc = -ENOMEM;
>> + goto err_alloc_vis_free;
>> }
>>
>> mutex_init(&vdpa_nic->lock);
>> @@ -125,11 +156,21 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
>> vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
>> vdpa_nic->efx = efx;
>> + vdpa_nic->max_queue_pairs = allocated_vis - 1;
>> vdpa_nic->pf_index = nic_data->pf_index;
>> vdpa_nic->vf_index = nic_data->vf_index;
>> vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
>> vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;
>>
>> + for (i = 0; i < (2 * vdpa_nic->max_queue_pairs); i++) {
>> + rc = ef100_vdpa_init_vring(vdpa_nic, i);
>> + if (rc) {
>> + pci_err(efx->pci_dev,
>> + "vring init idx: %u failed, rc: %d\n", i, rc);
>> + goto err_put_device;
>> + }
>> + }
>> +
>> rc = get_net_config(vdpa_nic);
>> if (rc)
>> goto err_put_device;
>> @@ -146,6 +187,9 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> err_put_device:
>> /* put_device invokes ef100_vdpa_free */
>> put_device(&vdpa_nic->vdpa_dev.dev);
>> +
>> +err_alloc_vis_free:
>> + efx_mcdi_free_vis(efx);
>> return ERR_PTR(rc);
>> }
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> index dcf4a8156415..348ca8a7404b 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> @@ -32,6 +32,21 @@
>> /* Alignment requirement of the Virtqueue */
>> #define EF100_VDPA_VQ_ALIGN 4096
>>
>> +/* Vring configuration definitions */
>> +#define EF100_VRING_ADDRESS_CONFIGURED 0x1
>> +#define EF100_VRING_SIZE_CONFIGURED 0x10
>> +#define EF100_VRING_READY_CONFIGURED 0x100
>> +#define EF100_VRING_CONFIGURED (EF100_VRING_ADDRESS_CONFIGURED | \
>> + EF100_VRING_SIZE_CONFIGURED | \
>> + EF100_VRING_READY_CONFIGURED)
>> +#define EF100_VRING_CREATED 0x1000
>> +
>> +/* Maximum size of msix name */
>> +#define EF100_VDPA_MAX_MSIX_NAME_SIZE 256
>> +
>> +/* Default high IOVA for MCDI buffer */
>> +#define EF100_VDPA_IOVA_BASE_ADDR 0x20000000000
>> +
>> /**
>> * enum ef100_vdpa_nic_state - possible states for a vDPA NIC
>> *
>> @@ -57,6 +72,41 @@ enum ef100_vdpa_vq_type {
>> EF100_VDPA_VQ_NTYPES
>> };
>>
>> +/**
>> + * struct ef100_vdpa_vring_info - vDPA vring data structure
>> + *
>> + * @desc: Descriptor area address of the vring
>> + * @avail: Available area address of the vring
>> + * @used: Device area address of the vring
>> + * @size: Number of entries in the vring
>> + * @vring_state: bit map to track vring configuration
>> + * @last_avail_idx: last available index of the vring
>> + * @last_used_idx: last used index of the vring
>> + * @doorbell_offset: doorbell offset
>> + * @doorbell_offset_valid: true if @doorbell_offset is updated
>> + * @vring_type: type of vring created
>> + * @vring_ctx: vring context information
>> + * @msix_name: device name for vring irq handler
>> + * @irq: irq number for vring irq handler
>> + * @cb: callback for vring interrupts
>> + */
>> +struct ef100_vdpa_vring_info {
>> + dma_addr_t desc;
>> + dma_addr_t avail;
>> + dma_addr_t used;
>> + u32 size;
>> + u16 vring_state;
>> + u32 last_avail_idx;
>> + u32 last_used_idx;
>> + u32 doorbell_offset;
>> + bool doorbell_offset_valid;
>> + enum ef100_vdpa_vq_type vring_type;
>> + struct efx_vring_ctx *vring_ctx;
>> + char msix_name[EF100_VDPA_MAX_MSIX_NAME_SIZE];
>> + u32 irq;
>> + struct vdpa_callback cb;
>> +};
>> +
>> /**
>> * struct ef100_vdpa_nic - vDPA NIC data structure
>> *
>> @@ -70,6 +120,7 @@ enum ef100_vdpa_vq_type {
>> * @features: negotiated feature bits
>> * @max_queue_pairs: maximum number of queue pairs supported
>> * @net_config: virtio_net_config data
>> + * @vring: vring information of the vDPA device.
>> * @mac_address: mac address of interface associated with this vdpa device
>> * @mac_configured: true after MAC address is configured
>> * @cfg_cb: callback for config change
>> @@ -86,6 +137,7 @@ struct ef100_vdpa_nic {
>> u64 features;
>> u32 max_queue_pairs;
>> struct virtio_net_config net_config;
>> + struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
>> u8 *mac_address;
>> bool mac_configured;
>> struct vdpa_callback cfg_cb;
>> @@ -95,6 +147,8 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data);
>> void ef100_vdpa_fini(struct efx_probe_data *probe_data);
>> int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
>> void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
>> +void ef100_vdpa_irq_vectors_free(void *data);
>> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>>
>> static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
>> {
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> index a2364ef9f492..0051c4c0e47c 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> @@ -9,13 +9,270 @@
>>
>> #include <linux/vdpa.h>
>> #include "ef100_vdpa.h"
>> +#include "io.h"
>> #include "mcdi_vdpa.h"
>>
>> +/* Get the queue's function-local index of the associated VI
>> + * virtqueue number queue 0 is reserved for MCDI
>> + */
>> +#define EFX_GET_VI_INDEX(vq_num) (((vq_num) / 2) + 1)
>> +
>> static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
>> {
>> return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
>> }
>>
>> +void ef100_vdpa_irq_vectors_free(void *data)
>> +{
>> + pci_free_irq_vectors(data);
>> +}
>> +
>> +static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + struct efx_vring_ctx *vring_ctx;
>> + u32 vi_index;
>> +
>> + if (idx % 2) /* Even VQ for RX and odd for TX */
>> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_TYPE_NET_TXQ;
>> + else
>> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_TYPE_NET_RXQ;
>> + vi_index = EFX_GET_VI_INDEX(idx);
>> + vring_ctx = efx_vdpa_vring_init(vdpa_nic->efx, vi_index,
>> + vdpa_nic->vring[idx].vring_type);
>> + if (IS_ERR(vring_ctx))
>> + return PTR_ERR(vring_ctx);
>> +
>> + vdpa_nic->vring[idx].vring_ctx = vring_ctx;
>> + return 0;
>> +}
>> +
>> +static void delete_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + efx_vdpa_vring_fini(vdpa_nic->vring[idx].vring_ctx);
>> + vdpa_nic->vring[idx].vring_ctx = NULL;
>> +}
>> +
>> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>> + vdpa_nic->vring[idx].vring_state = 0;
>> + vdpa_nic->vring[idx].last_avail_idx = 0;
>> + vdpa_nic->vring[idx].last_used_idx = 0;
>> +}
>> +
>> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + u32 offset;
>> + int rc;
>> +
>> + vdpa_nic->vring[idx].irq = -EINVAL;
>> + rc = create_vring_ctx(vdpa_nic, idx);
>> + if (rc) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: create_vring_ctx failed, idx:%u, err:%d\n",
>> + __func__, idx, rc);
>> + return rc;
>> + }
>> +
>> + rc = efx_vdpa_get_doorbell_offset(vdpa_nic->vring[idx].vring_ctx,
>> + &offset);
>> + if (rc) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: get_doorbell failed idx:%u, err:%d\n",
>> + __func__, idx, rc);
>> + goto err_get_doorbell_offset;
>> + }
>> + vdpa_nic->vring[idx].doorbell_offset = offset;
>> + vdpa_nic->vring[idx].doorbell_offset_valid = true;
>> +
>> + return 0;
>> +
>> +err_get_doorbell_offset:
>> + delete_vring_ctx(vdpa_nic, idx);
>> + return rc;
>> +}
>> +
>> +static bool is_qid_invalid(struct ef100_vdpa_nic *vdpa_nic, u16 idx,
>> + const char *caller)
>> +{
>> + if (unlikely(idx >= (vdpa_nic->max_queue_pairs * 2))) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: Invalid qid %u\n", caller, idx);
>> + return true;
>> + }
>> + return false;
>> +}
>> +
>> +static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
>> + u16 idx, u64 desc_area, u64 driver_area,
>> + u64 device_area)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return -EINVAL;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + vdpa_nic->vring[idx].desc = desc_area;
>> + vdpa_nic->vring[idx].avail = driver_area;
>> + vdpa_nic->vring[idx].used = device_area;
>> + vdpa_nic->vring[idx].vring_state |= EF100_VRING_ADDRESS_CONFIGURED;
>> + mutex_unlock(&vdpa_nic->lock);
>> + return 0;
>> +}
>> +
>> +static void ef100_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return;
>> +
>> + if (!is_power_of_2(num)) {
>> + dev_err(&vdev->dev, "%s: Index:%u size:%u not power of 2\n",
>> + __func__, idx, num);
>> + return;
>> + }
> Note that this is not a requirement for packed virtqueue.
>
> """
> Queue Size corresponds to the maximum number of descriptors in the
> virtqueue5. The Queue Size value does not have to be a power of 2.
> """
Yes, but we are using split vrings and virtio spec states "Queue Size
value is always a power of 2" for Split virtqueues.
>
>> + if (num > EF100_VDPA_VQ_NUM_MAX_SIZE) {
>> + dev_err(&vdev->dev, "%s: Index:%u size:%u more than max:%u\n",
>> + __func__, idx, num, EF100_VDPA_VQ_NUM_MAX_SIZE);
>> + return;
>> + }
>> + mutex_lock(&vdpa_nic->lock);
>> + vdpa_nic->vring[idx].size = num;
>> + vdpa_nic->vring[idx].vring_state |= EF100_VRING_SIZE_CONFIGURED;
>> + mutex_unlock(&vdpa_nic->lock);
>> +}
>> +
>> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + u32 idx_val;
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return;
>> +
>> + if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>> + return;
> In which case could we hit this condition?
I've noticed this condition in regular testing with vhost-vdpa. The
first couple of kick_vq calls arrive when the HW queues aren't created
yet. .I think userspace assumes queues to be ready soon after sending
DRIVER_OK. However, there is a little time window between that and when
the HW VQs are actually ready for datapath.
>
>> +
>> + idx_val = idx;
>> + _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>> + vdpa_nic->vring[idx].doorbell_offset);
>> +}
>> +
>> +static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
>> + struct vdpa_callback *cb)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return;
>> +
>> + if (cb)
>> + vdpa_nic->vring[idx].cb = *cb;
>> +}
>> +
>> +static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
>> + bool ready)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + if (ready) {
>> + vdpa_nic->vring[idx].vring_state |=
>> + EF100_VRING_READY_CONFIGURED;
> I think it would be sufficient to have EF100_VRING_READY_CONFIGURED
> here. With this set, the device can think the vq configuration is done
> by the driver.
>
> Or is there anything special for size and num?
The virtqueue is considered ready for datapath when it is fully
configured (both size and address set and enabled with set_vq_ready).
Depending on merely the queue enable (EF100_VRING_READY_CONFIGURED)
would assume valid values for vq size and addresses, which we wish to avoid.
>
> Thanks
>
>
>> + } else {
>> + vdpa_nic->vring[idx].vring_state &=
>> + ~EF100_VRING_READY_CONFIGURED;
>> + }
>> + mutex_unlock(&vdpa_nic->lock);
>> +}
>> +
>> +static bool ef100_vdpa_get_vq_ready(struct vdpa_device *vdev, u16 idx)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + bool ready;
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return false;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + ready = vdpa_nic->vring[idx].vring_state & EF100_VRING_READY_CONFIGURED;
>> + mutex_unlock(&vdpa_nic->lock);
>> + return ready;
>> +}
>> +
>> +static int ef100_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx,
>> + const struct vdpa_vq_state *state)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return -EINVAL;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + vdpa_nic->vring[idx].last_avail_idx = state->split.avail_index;
>> + vdpa_nic->vring[idx].last_used_idx = state->split.avail_index;
>> + mutex_unlock(&vdpa_nic->lock);
>> + return 0;
>> +}
>> +
>> +static int ef100_vdpa_get_vq_state(struct vdpa_device *vdev,
>> + u16 idx, struct vdpa_vq_state *state)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return -EINVAL;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + state->split.avail_index = (u16)vdpa_nic->vring[idx].last_used_idx;
>> + mutex_unlock(&vdpa_nic->lock);
>> +
>> + return 0;
>> +}
>> +
>> +static struct vdpa_notification_area
>> + ef100_vdpa_get_vq_notification(struct vdpa_device *vdev,
>> + u16 idx)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + struct vdpa_notification_area notify_area = {0, 0};
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + goto end;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + notify_area.addr = (uintptr_t)(vdpa_nic->efx->membase_phys +
>> + vdpa_nic->vring[idx].doorbell_offset);
>> + /* VDPA doorbells are at a stride of VI/2
>> + * One VI stride is shared by both rx & tx doorbells
>> + */
>> + notify_area.size = vdpa_nic->efx->vi_stride / 2;
>> + mutex_unlock(&vdpa_nic->lock);
>> +
>> +end:
>> + return notify_area;
>> +}
>> +
>> +static int ef100_get_vq_irq(struct vdpa_device *vdev, u16 idx)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + u32 irq;
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return -EINVAL;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + irq = vdpa_nic->vring[idx].irq;
>> + mutex_unlock(&vdpa_nic->lock);
>> +
>> + return irq;
>> +}
>> +
>> static u32 ef100_vdpa_get_vq_align(struct vdpa_device *vdev)
>> {
>> return EF100_VDPA_VQ_ALIGN;
>> @@ -80,6 +337,8 @@ static void ef100_vdpa_set_config_cb(struct vdpa_device *vdev,
>>
>> if (cb)
>> vdpa_nic->cfg_cb = *cb;
>> + else
>> + memset(&vdpa_nic->cfg_cb, 0, sizeof(vdpa_nic->cfg_cb));
>> }
>>
>> static u16 ef100_vdpa_get_vq_num_max(struct vdpa_device *vdev)
>> @@ -137,14 +396,30 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
>> static void ef100_vdpa_free(struct vdpa_device *vdev)
>> {
>> struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + int i;
>>
>> if (vdpa_nic) {
>> + for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>> + reset_vring(vdpa_nic, i);
>> + if (vdpa_nic->vring[i].vring_ctx)
>> + delete_vring_ctx(vdpa_nic, i);
>> + }
>> mutex_destroy(&vdpa_nic->lock);
>> vdpa_nic->efx->vdpa_nic = NULL;
>> }
>> }
>>
>> const struct vdpa_config_ops ef100_vdpa_config_ops = {
>> + .set_vq_address = ef100_vdpa_set_vq_address,
>> + .set_vq_num = ef100_vdpa_set_vq_num,
>> + .kick_vq = ef100_vdpa_kick_vq,
>> + .set_vq_cb = ef100_vdpa_set_vq_cb,
>> + .set_vq_ready = ef100_vdpa_set_vq_ready,
>> + .get_vq_ready = ef100_vdpa_get_vq_ready,
>> + .set_vq_state = ef100_vdpa_set_vq_state,
>> + .get_vq_state = ef100_vdpa_get_vq_state,
>> + .get_vq_notification = ef100_vdpa_get_vq_notification,
>> + .get_vq_irq = ef100_get_vq_irq,
>> .get_vq_align = ef100_vdpa_get_vq_align,
>> .get_device_features = ef100_vdpa_get_device_features,
>> .set_driver_features = ef100_vdpa_set_driver_features,
>> --
>> 2.30.1
>>

2023-03-13 12:39:43

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 04/14] sfc: evaluate vdpa support based on FW capability CLIENT_CMD_VF_PROXY


On 3/10/23 10:34, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 7, 2023 at 7:37 PM Gautam Dawar <[email protected]> wrote:
>> Add and update vdpa_supported field to struct efx_nic to true if
>> running Firmware supports CLIENT_CMD_VF_PROXY capability. This is
>> required to ensure DMA isolation between MCDI command buffer and guest
>> buffers.
>>
>> Signed-off-by: Gautam Dawar <[email protected]>
>> ---
>> drivers/net/ethernet/sfc/ef100_netdev.c | 26 +++++++++++++++---
>> drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++----------------
>> drivers/net/ethernet/sfc/ef100_nic.h | 6 +++--
>> drivers/net/ethernet/sfc/ef100_vdpa.h | 5 ++--
>> 4 files changed, 41 insertions(+), 31 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c
>> index d916877b5a9a..5d93e870d9b7 100644
>> --- a/drivers/net/ethernet/sfc/ef100_netdev.c
>> +++ b/drivers/net/ethernet/sfc/ef100_netdev.c
>> @@ -355,6 +355,28 @@ void ef100_remove_netdev(struct efx_probe_data *probe_data)
>> efx->state = STATE_PROBED;
>> }
>>
>> +static void efx_ef100_update_tso_features(struct efx_nic *efx)
>> +{
>> + struct ef100_nic_data *nic_data = efx->nic_data;
>> + struct net_device *net_dev = efx->net_dev;
>> + netdev_features_t tso;
>> +
>> + if (!efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3))
>> + return;
>> +
>> + tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
>> + NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
>> + NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
>> +
>> + net_dev->features |= tso;
>> + net_dev->hw_features |= tso;
>> + net_dev->hw_enc_features |= tso;
>> + /* EF100 HW can only offload outer checksums if they are UDP,
>> + * so for GRE_CSUM we have to use GSO_PARTIAL.
>> + */
>> + net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
>> +}
> I don't see a direct relationship between vDPA and the TSO capability.
> Is this an independent fix?
This isn't actually fixing any issue. This a minor code refactoring that
wraps-up updating of the TSO capabilities in a separate function for
better readability.
>
>> +
>> int ef100_probe_netdev(struct efx_probe_data *probe_data)
>> {
>> struct efx_nic *efx = &probe_data->efx;
>> @@ -387,9 +409,7 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
>> ESE_EF100_DP_GZ_TSO_MAX_HDR_NUM_SEGS_DEFAULT);
>> efx->mdio.dev = net_dev;
>>
>> - rc = efx_ef100_init_datapath_caps(efx);
>> - if (rc < 0)
>> - goto fail;
>> + efx_ef100_update_tso_features(efx);
>>
>> rc = ef100_phy_probe(efx);
>> if (rc)
>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
>> index 8cbe5e0f4bdf..ef6e295efcf7 100644
>> --- a/drivers/net/ethernet/sfc/ef100_nic.c
>> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
>> @@ -161,7 +161,7 @@ int ef100_get_mac_address(struct efx_nic *efx, u8 *mac_address,
>> return 0;
>> }
>>
>> -int efx_ef100_init_datapath_caps(struct efx_nic *efx)
>> +static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
>> {
>> MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_V7_OUT_LEN);
>> struct ef100_nic_data *nic_data = efx->nic_data;
>> @@ -197,25 +197,15 @@ int efx_ef100_init_datapath_caps(struct efx_nic *efx)
>> if (rc)
>> return rc;
>>
>> - if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) {
>> - struct net_device *net_dev = efx->net_dev;
>> - netdev_features_t tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
>> - NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
>> - NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
>> -
>> - net_dev->features |= tso;
>> - net_dev->hw_features |= tso;
>> - net_dev->hw_enc_features |= tso;
>> - /* EF100 HW can only offload outer checksums if they are UDP,
>> - * so for GRE_CSUM we have to use GSO_PARTIAL.
>> - */
>> - net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
>> - }
>> efx->num_mac_stats = MCDI_WORD(outbuf,
>> GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS);
>> netif_dbg(efx, probe, efx->net_dev,
>> "firmware reports num_mac_stats = %u\n",
>> efx->num_mac_stats);
>> +
>> + nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
>> + CLIENT_CMD_VF_PROXY) &&
>> + efx->type->is_vf;
>> return 0;
>> }
>>
>> @@ -806,13 +796,6 @@ static char *bar_config_name[] = {
>> [EF100_BAR_CONFIG_VDPA] = "vDPA",
>> };
>>
>> -#ifdef CONFIG_SFC_VDPA
>> -static bool efx_vdpa_supported(struct efx_nic *efx)
>> -{
>> - return efx->type->is_vf;
>> -}
>> -#endif
>> -
>> int efx_ef100_set_bar_config(struct efx_nic *efx,
>> enum ef100_bar_config new_config)
>> {
>> @@ -828,7 +811,7 @@ int efx_ef100_set_bar_config(struct efx_nic *efx,
>>
>> #ifdef CONFIG_SFC_VDPA
>> /* Current EF100 hardware supports vDPA on VFs only */
>> - if (new_config == EF100_BAR_CONFIG_VDPA && !efx_vdpa_supported(efx)) {
>> + if (new_config == EF100_BAR_CONFIG_VDPA && !nic_data->vdpa_supported) {
>> pci_err(efx->pci_dev, "vdpa over PF not supported : %s",
>> efx->name);
>> return -EOPNOTSUPP;
>> @@ -1208,6 +1191,12 @@ static int ef100_probe_main(struct efx_nic *efx)
>> goto fail;
>> }
>>
>> + rc = efx_ef100_init_datapath_caps(efx);
>> + if (rc) {
>> + pci_info(efx->pci_dev, "Unable to initialize datapath caps\n");
>> + goto fail;
>> + }
>> +
>> return 0;
>> fail:
>> return rc;
>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h
>> index 4562982f2965..117a73d0795c 100644
>> --- a/drivers/net/ethernet/sfc/ef100_nic.h
>> +++ b/drivers/net/ethernet/sfc/ef100_nic.h
>> @@ -76,6 +76,9 @@ struct ef100_nic_data {
>> u32 datapath_caps3;
>> unsigned int pf_index;
>> u16 warm_boot_count;
>> +#ifdef CONFIG_SFC_VDPA
>> + bool vdpa_supported; /* true if vdpa is supported on this PCIe FN */
>> +#endif
>> u8 port_id[ETH_ALEN];
>> DECLARE_BITMAP(evq_phases, EFX_MAX_CHANNELS);
>> enum ef100_bar_config bar_config;
>> @@ -95,9 +98,8 @@ struct ef100_nic_data {
>> };
>>
>> #define efx_ef100_has_cap(caps, flag) \
>> - (!!((caps) & BIT_ULL(MC_CMD_GET_CAPABILITIES_V4_OUT_ ## flag ## _LBN)))
>> + (!!((caps) & BIT_ULL(MC_CMD_GET_CAPABILITIES_V7_OUT_ ## flag ## _LBN)))
>>
>> -int efx_ef100_init_datapath_caps(struct efx_nic *efx);
>> int ef100_phy_probe(struct efx_nic *efx);
>> int ef100_filter_table_probe(struct efx_nic *efx);
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> index f6564448d0c7..90062fd8a25d 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> @@ -1,7 +1,6 @@
>> /* SPDX-License-Identifier: GPL-2.0 */
>> -/* Driver for Xilinx network controllers and boards
>> - * Copyright (C) 2020-2022, Xilinx, Inc.
>> - * Copyright (C) 2022, Advanced Micro Devices, Inc.
>> +/* Driver for AMD network controllers and boards
>> + * Copyright (C) 2023, Advanced Micro Devices, Inc.
> Let's fix this in the patch that introduces this.

Sure, will fix.

Thanks

>
> Thanks
>
>
>
>> *
>> * This program is free software; you can redistribute it and/or modify it
>> * under the terms of the GNU General Public License version 2 as published
>> --
>> 2.30.1
>>

2023-03-13 14:38:54

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 03/14] sfc: update MCDI headers for CLIENT_CMD_VF_PROXY capability bit


On 3/8/23 21:45, Martin Habets wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 07, 2023 at 12:12:15PM +0000, Lucero Palau, Alejandro wrote:
>> On 3/7/23 11:36, Gautam Dawar wrote:
>>> vDPA requires the ability to proxy MCDI commands from a PF to a VF
>>> there by using PF's IOMMU domain for executing vDPA VF's MCDI commands
>>> ensuring isolation from the DMA domain used by guest buffers.
>>> A new capability bit CLIENT_CMD_VF_PROXY has been added to Firmware,
>>> which when exposed, suggests that Firmware supports MC_CMD_CLIENT_CMD
>>> to VFs and hence supports vDPA requirement.
>>> mcdi_pcol.h is a tool generated file and hence may not be free from
>>> all checks and/or warnings when tested with checkpatch.pl script.
>>>
>>> Signed-off-by: Gautam Dawar <[email protected]>
>>> ---
>>> drivers/net/ethernet/sfc/mcdi_pcol.h | 4390 +++++++++++++++++++++++++-
>>> drivers/net/ethernet/sfc/mcdi_vdpa.c | 10 +-
>>> 2 files changed, 4288 insertions(+), 112 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/sfc/mcdi_pcol.h b/drivers/net/ethernet/sfc/mcdi_pcol.h
>>> index cd297e19cddc..bdb6a53b8be3 100644
>>> --- a/drivers/net/ethernet/sfc/mcdi_pcol.h
>>> +++ b/drivers/net/ethernet/sfc/mcdi_pcol.h
>>> @@ -2,10 +2,9 @@
>>> /****************************************************************************
>>> * Driver for Solarflare network controllers and boards
>>> * Copyright 2009-2018 Solarflare Communications Inc.
>>> - * Copyright 2019-2020 Xilinx Inc.
>>> + * Copyright 2019-2022 Xilinx Inc.
>>> */
>>>
>> 2023?

I can do that unless manual changes to this file are prohibited.

Martin?

>>
>>> -
>>> #ifndef MCDI_PCOL_H
>>> #define MCDI_PCOL_H
>>>
>>> @@ -72,19 +71,19 @@
>>> * | \------- Error
>>> * \------------------------------ Resync (always set)
>>> *
>>> - * The client writes it's request into MC shared memory, and rings the
>>> - * doorbell. Each request is completed by either by the MC writing
>>> + * The client writes its request into MC shared memory, and rings the
>>> + * doorbell. Each request is completed either by the MC writing
>> It seems this patch has been also seized for fixing a good number of typos.
>> I would not mind if one or two go into, but that is not the case here.
>> All those fixes should be in another patch out of this patchset.
> As stated in the description, mcdi_pcol.h is a generated file. We cannot
> pick and choose what parts to pick up, we always have to use the latest
> version that contains the changes we need.
>
> Martin
+1
>
>>> * back into shared memory, or by writing out an event.
>>> *
>>> * All MCDI commands support completion by shared memory response. Each
>>> * request may also contain additional data (accounted for by HEADER.LEN),
>>> - * and some response's may also contain additional data (again, accounted
>>> + * and some responses may also contain additional data (again, accounted
>>> * for by HEADER.LEN).
>>> *
>>> * Some MCDI commands support completion by event, in which any associated
>>> * response data is included in the event.
>>> *
>>> - * The protocol requires one response to be delivered for every request, a
>>> + * The protocol requires one response to be delivered for every request; a
>>> * request should not be sent unless the response for the previous request
>>> * has been received (either by polling shared memory, or by receiving
>>> * an event).
>>> @@ -121,7 +120,6 @@
>>>
>>> #define MCDI_CTL_SDU_LEN_MAX MCDI_CTL_SDU_LEN_MAX_V2
>>>
>>> -
>>> /* The MC can generate events for two reasons:
>>> * - To advance a shared memory request if XFLAGS_EVREQ was set
>>> * - As a notification (link state, i2c event), controlled
>>> @@ -165,6 +163,7 @@
>>> #define FSE_AZ_EV_CODE_MCDI_EVRESPONSE 0xc
>>>
>>>
>>> +
>>> #define MC_CMD_ERR_CODE_OFST 0
>>> #define MC_CMD_ERR_PROXY_PENDING_HANDLE_OFST 4
>>>
>>> @@ -228,7 +227,6 @@
>>> */
>>> #define EVB_STACK_ID(n) (((n) & 0xff) << 16)
>>>
>>> -
>>> /* Version 2 adds an optional argument to error returns: the errno value
>>> * may be followed by the (0-based) number of the first argument that
>>> * could not be processed.
>>> @@ -321,7 +319,7 @@
>>> /* enum: The requesting client is not a function */
>>> #define MC_CMD_ERR_CLIENT_NOT_FN 0x100c
>>> /* enum: The requested operation might require the command to be passed between
>>> - * MCs, and thetransport doesn't support that. Should only ever been seen over
>>> + * MCs, and the transport doesn't support that. Should only ever been seen over
>>> * the UART.
>>> */
>>> #define MC_CMD_ERR_TRANSPORT_NOPROXY 0x100d
>>> @@ -358,7 +356,7 @@
>>> * sub-variant switching.
>>> */
>>> #define MC_CMD_ERR_FILTERS_PRESENT 0x1014
>>> -/* enum: The clock whose frequency you've attempted to set set doesn't exist on
>>> +/* enum: The clock whose frequency you've attempted to set doesn't exist on
>>> * this NIC
>>> */
>>> #define MC_CMD_ERR_NO_CLOCK 0x1015
>>> @@ -640,7 +638,11 @@
>>> * be allocated by different counter blocks, so e.g. AR counter 42 is different
>>> * from CT counter 42. Generation counts are also type-specific. This value is
>>> * also present in the header of streaming counter packets, in the IDENTIFIER
>>> - * field (see packetiser packet format definitions).
>>> + * field (see packetiser packet format definitions). Also note that LACP
>>> + * counter IDs are not allocated individually, instead the counter IDs are
>>> + * directly tied to the LACP balance table indices. These in turn are allocated
>>> + * in large contiguous blocks as a LAG config. Calling MAE_COUNTER_ALLOC/FREE
>>> + * with an LACP counter type will return EPERM.
>>> */
>>> /* enum: Action Rule counters - can be referenced in AR response. */
>>> #define MAE_COUNTER_TYPE_AR 0x0
>>> @@ -648,6 +650,14 @@
>>> #define MAE_COUNTER_TYPE_CT 0x1
>>> /* enum: Outer Rule counters - can be referenced in OR response. */
>>> #define MAE_COUNTER_TYPE_OR 0x2
>>> +/* enum: LACP counters - linked to LACP balance table entries. */
>>> +#define MAE_COUNTER_TYPE_LACP 0x3
>>> +
>>> +/* MAE_COUNTER_ID enum: ID of allocated counter or counter list. */
>>> +/* enum: A counter ID that is guaranteed never to represent a real counter or
>>> + * counter list.
>>> + */
>>> +#define MAE_COUNTER_ID_NULL 0xffffffff
>>>
>>> /* TABLE_ID enum: Unique IDs for tables. The 32-bit ID values have been
>>> * structured with bits [31:24] reserved (0), [23:16] indicating which major
>>> @@ -656,7 +666,9 @@
>>> * variations of the same table. (All of the tables currently defined within
>>> * the streaming engines are listed here, but this does not imply that they are
>>> * all supported - MC_CMD_TABLE_LIST returns the list of actually supported
>>> - * tables.)
>>> + * tables.) The DPU offload engines' enumerators follow a deliberate pattern:
>>> + * 0x01010000 + is_dpu_net * 0x10000 + is_wr_or_tx * 0x8000 + is_lite_pipe *
>>> + * 0x1000 + oe_engine_type * 0x100 + oe_instance_within_pipe * 0x10
>>> */
>>> /* enum: Outer_Rule_Table in the MAE - refer to SF-123102-TC. */
>>> #define TABLE_ID_OUTER_RULE_TABLE 0x10000
>>> @@ -694,6 +706,70 @@
>>> #define TABLE_ID_RSS_CONTEXT_TABLE 0x20200
>>> /* enum: Indirection_Table in VNIC Rx - refer to SF-123102-TC. */
>>> #define TABLE_ID_INDIRECTION_TABLE 0x20300
>>> +/* enum: DPU.host read pipe first CRC offload engine profiles - refer to
>>> + * XN-200147-AN.
>> I think this is an internal document not available to the public.
>> Please, remove all those references.

Again, not sure if any manual changes are allowed to this file. IIUC, we
simply replace this file with the newer version generated by the tool
whenever any new changes are added.

Thanks

>>
>>> + */
>>> +#define TABLE_ID_DPU_HOST_RD_CRC0_OE_PROFILE 0x1010000
>>> +/* enum: DPU.host read pipe second CRC offload engine profiles - refer to
>>> + * XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_HOST_RD_CRC1_OE_PROFILE 0x1010010
>>> +/* enum: DPU.host write pipe first CRC offload engine profiles - refer to
>>> + * XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_HOST_WR_CRC0_OE_PROFILE 0x1018000
>>> +/* enum: DPU.host write pipe second CRC offload engine profiles - refer to
>>> + * XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_HOST_WR_CRC1_OE_PROFILE 0x1018010
>>> +/* enum: DPU.net 'full' receive pipe CRC offload engine profiles - refer to
>>> + * XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_RX_CRC0_OE_PROFILE 0x1020000
>>> +/* enum: DPU.net 'full' receive pipe first checksum offload engine profiles -
>>> + * refer to XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_RX_CSUM0_OE_PROFILE 0x1020100
>>> +/* enum: DPU.net 'full' receive pipe second checksum offload engine profiles -
>>> + * refer to XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_RX_CSUM1_OE_PROFILE 0x1020110
>>> +/* enum: DPU.net 'full' receive pipe AES-GCM offload engine profiles - refer to
>>> + * XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_RX_AES_GCM0_OE_PROFILE 0x1020200
>>> +/* enum: DPU.net 'lite' receive pipe CRC offload engine profiles - refer to
>>> + * XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_RXLITE_CRC0_OE_PROFILE 0x1021000
>>> +/* enum: DPU.net 'lite' receive pipe checksum offload engine profiles - refer
>>> + * to XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_RXLITE_CSUM0_OE_PROFILE 0x1021100
>>> +/* enum: DPU.net 'full' transmit pipe CRC offload engine profiles - refer to
>>> + * XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_TX_CRC0_OE_PROFILE 0x1028000
>>> +/* enum: DPU.net 'full' transmit pipe first checksum offload engine profiles -
>>> + * refer to XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_TX_CSUM0_OE_PROFILE 0x1028100
>>> +/* enum: DPU.net 'full' transmit pipe second checksum offload engine profiles -
>>> + * refer to XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_TX_CSUM1_OE_PROFILE 0x1028110
>>> +/* enum: DPU.net 'full' transmit pipe AES-GCM offload engine profiles - refer
>>> + * to XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_TX_AES_GCM0_OE_PROFILE 0x1028200
>>> +/* enum: DPU.net 'lite' transmit pipe CRC offload engine profiles - refer to
>>> + * XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_TXLITE_CRC0_OE_PROFILE 0x1029000
>>> +/* enum: DPU.net 'lite' transmit pipe checksum offload engine profiles - refer
>>> + * to XN-200147-AN.
>>> + */
>>> +#define TABLE_ID_DPU_NET_TXLITE_CSUM0_OE_PROFILE 0x1029100
>>>
>>> /* TABLE_COMPRESSED_VLAN enum: Compressed VLAN TPID as used by some field
>>> * types; can be calculated by (((ether_type_msb >> 2) & 0x4) ^ 0x4) |
>>> @@ -734,6 +810,42 @@
>>> /* enum: RSS uses even spreading calculation. */
>>> #define TABLE_RSS_SPREAD_MODE_EVEN 0x1
>>>
>>> +/* CRC_VARIANT enum: Operation for the DPU CRC engine to perform. */
>>> +/* enum: Calculate a 32-bit CRC. */
>>> +#define CRC_VARIANT_CRC32 0x1
>>> +/* enum: Calculate a 64-bit CRC. */
>>> +#define CRC_VARIANT_CRC64 0x2
>>> +
>>> +/* DPU_CSUM_OP enum: Operation for the DPU checksum engine to perform. */
>>> +/* enum: Calculate the checksum for a TCP payload, output result on OPR bus. */
>>> +#define DPU_CSUM_OP_CALC_TCP 0x0
>>> +/* enum: Calculate the checksum for a UDP payload, output result on OPR bus. */
>>> +#define DPU_CSUM_OP_CALC_UDP 0x1
>>> +/* enum: Calculate the checksum for a TCP payload, output match/not match value
>>> + * on OPR bus.
>>> + */
>>> +#define DPU_CSUM_OP_VALIDATE_TCP 0x2
>>> +/* enum: Calculate the checksum for a UDP payload, output match/not match value
>>> + * on OPR bus.
>>> + */
>>> +#define DPU_CSUM_OP_VALIDATE_UDP 0x3
>>> +
>>> +/* GCM_OP_CODE enum: Operation for the DPU AES-GCM engine to perform. */
>>> +/* enum: Encrypt/decrypt a stream of data. */
>>> +#define GCM_OP_CODE_BULK_CRYPT 0x0
>>> +/* enum: Calculate the authentication tag for a stream of data. */
>>> +#define GCM_OP_CODE_BULK_AUTH 0x1
>>> +/* enum: Encrypt/decrypt an IPsec packet. */
>>> +#define GCM_OP_CODE_IPSEC_CRYPT 0x2
>>> +/* enum: Calculate the authentication tag of an IPsec packet. */
>>> +#define GCM_OP_CODE_IPSEC_AUTH 0x3
>>> +
>>> +/* AES_KEY_LEN enum: Key size for AES crypto operations */
>>> +/* enum: 128 bit key size. */
>>> +#define AES_KEY_LEN_AES_KEY_128 0x0
>>> +/* enum: 256 bit key size. */
>>> +#define AES_KEY_LEN_AES_KEY_256 0x1
>>> +
>>> /* TABLE_FIELD_ID enum: Unique IDs for fields. Related concepts have been
>>> * loosely grouped together into blocks with gaps for expansion, but the values
>>> * are arbitrary. Field IDs are not specific to particular tables, and in some
>>> @@ -1026,6 +1138,16 @@
>>> #define TABLE_FIELD_ID_BAL_TBL_BASE_DIV64 0xde
>>> /* enum: Length of balance table region: 0=>64, 1=>128, 2=>256. */
>>> #define TABLE_FIELD_ID_BAL_TBL_LEN_ID 0xdf
>>> +/* enum: LACP LAG ID (i.e. the low 3 bits of LACP LAG mport ID), indexing
>>> + * LACP_LAG_Config_Table. Refer to SF-123102-TC.
>>> + */
>>> +#define TABLE_FIELD_ID_LACP_LAG_ID 0xe0
>>> +/* enum: Address in LACP_Balance_Table. The balance table is partitioned
>>> + * between LAGs according to the settings in LACP_LAG_Config_Table and then
>>> + * indexed by the LACP hash, providing the mapping to destination mports. Refer
>>> + * to SF-123102-TC.
>>> + */
>>> +#define TABLE_FIELD_ID_BAL_TBL_ADDR 0xe1
>>> /* enum: UDP port to match for UDP-based encapsulations; required to be 0 for
>>> * other encapsulation types.
>>> */
>>> @@ -1082,6 +1204,58 @@
>>> #define TABLE_FIELD_ID_INDIR_TBL_LEN_ID 0x105
>>> /* enum: An offset to be applied to the base destination queue ID. */
>>> #define TABLE_FIELD_ID_INDIR_OFFSET 0x106
>>> +/* enum: DPU offload engine profile ID to address. */
>>> +#define TABLE_FIELD_ID_OE_PROFILE 0x3e8
>>> +/* enum: Width of the CRC to calculate - see CRC_VARIANT enum. */
>>> +#define TABLE_FIELD_ID_CRC_VARIANT 0x3f2
>>> +/* enum: If set, reflect the bits of each input byte, bit 7 is LSB, bit 0 is
>>> + * MSB. If clear, bit 7 is MSB, bit 0 is LSB.
>>> + */
>>> +#define TABLE_FIELD_ID_CRC_REFIN 0x3f3
>>> +/* enum: If set, reflect the bits of each output byte, bit 7 is LSB, bit 0 is
>>> + * MSB. If clear, bit 7 is MSB, bit 0 is LSB.
>>> + */
>>> +#define TABLE_FIELD_ID_CRC_REFOUT 0x3f4
>>> +/* enum: If set, invert every bit of the output value. */
>>> +#define TABLE_FIELD_ID_CRC_INVOUT 0x3f5
>>> +/* enum: The CRC polynomial to use for checksumming, in normal form. See
>>> + * https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Specification for a
>>> + * description of normal form.
>>> + */
>>> +#define TABLE_FIELD_ID_CRC_POLY 0x3f6
>>> +/* enum: Operation for the checksum engine to perform - see DPU_CSUM_OP enum.
>>> + */
>>> +#define TABLE_FIELD_ID_CSUM_OP 0x410
>>> +/* enum: Byte offset of checksum relative to region_start (for VALIDATE_*
>>> + * operations only).
>>> + */
>>> +#define TABLE_FIELD_ID_CSUM_OFFSET 0x411
>>> +/* enum: Indicates there is additional data on OPR bus that needs to be
>>> + * incorporated into the payload checksum.
>>> + */
>>> +#define TABLE_FIELD_ID_CSUM_OPR_ADDITIONAL_DATA 0x412
>>> +/* enum: Log2 data size of additional data on OPR bus. */
>>> +#define TABLE_FIELD_ID_CSUM_OPR_DATA_SIZE_LOG2 0x413
>>> +/* enum: 4 byte offset of where to find the additional data on the OPR bus. */
>>> +#define TABLE_FIELD_ID_CSUM_OPR_4B_OFF 0x414
>>> +/* enum: Operation type for the AES-GCM core - see GCM_OP_CODE enum. */
>>> +#define TABLE_FIELD_ID_GCM_OP_CODE 0x41a
>>> +/* enum: Key length - AES_KEY_LEN enum. */
>>> +#define TABLE_FIELD_ID_GCM_KEY_LEN 0x41b
>>> +/* enum: OPR 4 byte offset for ICV or GHASH output (only in BULK_* mode) or
>>> + * IPSEC descrypt output.
>>> + */
>>> +#define TABLE_FIELD_ID_GCM_OPR_4B_OFFSET 0x41c
>>> +/* enum: If OP_CODE is BULK_*, indicates Emit GHASH (Fragment mode). Else,
>>> + * indicates IPSEC-ESN mode.
>>> + */
>>> +#define TABLE_FIELD_ID_GCM_EMIT_GHASH_ISESN 0x41d
>>> +/* enum: Replay Protection Enable. */
>>> +#define TABLE_FIELD_ID_GCM_REPLAY_PROTECT_EN 0x41e
>>> +/* enum: IPSEC Encrypt ESP trailer NEXT_HEADER byte. */
>>> +#define TABLE_FIELD_ID_GCM_NEXT_HDR 0x41f
>>> +/* enum: Replay Window Size. */
>>> +#define TABLE_FIELD_ID_GCM_REPLAY_WIN_SIZE 0x420
>>>
>>> /* MCDI_EVENT structuredef: The structure of an MCDI_EVENT on Siena/EF10/EF100
>>> * platforms
>>> @@ -1237,7 +1411,7 @@
>>> #define MCDI_EVENT_AOE_FPGA_LOAD_FAILED 0xe
>>> /* enum: Notify that invalid flash type detected */
>>> #define MCDI_EVENT_AOE_INVALID_FPGA_FLASH_TYPE 0xf
>>> -/* enum: Notify that the attempt to run FPGA Controller firmware timedout */
>>> +/* enum: Notify that the attempt to run FPGA Controller firmware timed out */
>>> #define MCDI_EVENT_AOE_FC_RUN_TIMEDOUT 0x10
>>> /* enum: Failure to probe one or more FPGA boot flash chips */
>>> #define MCDI_EVENT_AOE_FPGA_BOOT_FLASH_INVALID 0x11
>>> @@ -1255,7 +1429,7 @@
>>> #define MCDI_EVENT_AOE_ERR_FC_ASSERT_INFO_WIDTH 8
>>> /* enum: FC Assert happened, but the register information is not available */
>>> #define MCDI_EVENT_AOE_ERR_FC_ASSERT_SEEN 0x0
>>> -/* enum: The register information for FC Assert is ready for readinng by driver
>>> +/* enum: The register information for FC Assert is ready for reading by driver
>>> */
>>> #define MCDI_EVENT_AOE_ERR_FC_ASSERT_DATA_READY 0x1
>>> #define MCDI_EVENT_AOE_ERR_CODE_FPGA_HEADER_VERIFY_FAILED_OFST 0
>>> @@ -1364,6 +1538,12 @@
>>> #define MCDI_EVENT_MODULECHANGE_SEQ_OFST 0
>>> #define MCDI_EVENT_MODULECHANGE_SEQ_LBN 30
>>> #define MCDI_EVENT_MODULECHANGE_SEQ_WIDTH 2
>>> +#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_OFST 0
>>> +#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_LBN 0
>>> +#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_WIDTH 16
>>> +#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_OFST 0
>>> +#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_LBN 16
>>> +#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_WIDTH 16
>>> #define MCDI_EVENT_DATA_LBN 0
>>> #define MCDI_EVENT_DATA_WIDTH 32
>>> /* Alias for PTP_DATA. */
>>> @@ -1500,6 +1680,12 @@
>>> * change to the journal.
>>> */
>>> #define MCDI_EVENT_CODE_MPORT_JOURNAL_CHANGE 0x27
>>> +/* enum: Notification that a source queue is enabled and attached to its proxy
>>> + * sink queue. SRC field contains the handle of the affected descriptor proxy
>>> + * function. DATA field contains the relative source queue number and absolute
>>> + * VI ID.
>>> + */
>>> +#define MCDI_EVENT_CODE_DESC_PROXY_FUNC_QUEUE_START 0x28
>>> /* enum: Artificial event generated by host and posted via MC for test
>>> * purposes.
>>> */
>>> @@ -1977,7 +2163,7 @@
>>> #define MC_CMD_COPYCODE 0x3
>>> #undef MC_CMD_0x3_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x3_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x3_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_COPYCODE_IN msgrequest */
>>> #define MC_CMD_COPYCODE_IN_LEN 16
>>> @@ -3943,11 +4129,15 @@
>>> /***********************************/
>>> /* MC_CMD_CSR_READ32
>>> * Read 32bit words from the indirect memory map.
>>> + *
>>> + * Note - this command originally belonged to INSECURE category. But access is
>>> + * required to specific registers for customer diagnostics. The command handler
>>> + * has additional checks to reject insecure calls.
>>> */
>>> #define MC_CMD_CSR_READ32 0xc
>>> #undef MC_CMD_0xc_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0xc_PRIVILEGE_CTG SRIOV_CTG_INSECURE
>>> +#define MC_CMD_0xc_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>>
>>> /* MC_CMD_CSR_READ32_IN msgrequest */
>>> #define MC_CMD_CSR_READ32_IN_LEN 12
>>> @@ -4013,7 +4203,7 @@
>>> #define MC_CMD_HP 0x54
>>> #undef MC_CMD_0x54_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x54_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x54_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_HP_IN msgrequest */
>>> #define MC_CMD_HP_IN_LEN 16
>>> @@ -4931,6 +5121,53 @@
>>> /* MC_CMD_GET_PHY_CFG_IN msgrequest */
>>> #define MC_CMD_GET_PHY_CFG_IN_LEN 0
>>>
>>> +/* MC_CMD_GET_PHY_CFG_IN_V2 msgrequest */
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_LEN 8
>>> +/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
>>> + * identifies a real or virtual network port by MAE port and link end. See the
>>> + * structure definition for more details
>>> + */
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_OFST 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LEN 8
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_OFST 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_LEN 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_LBN 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_WIDTH 32
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_OFST 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_LEN 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_LBN 32
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_WIDTH 32
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LINK_END_OFST 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LINK_END_LEN 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_OFST 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LEN 8
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_OFST 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_LEN 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_LBN 0
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_WIDTH 32
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_OFST 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_LEN 4
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_LBN 32
>>> +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_WIDTH 32
>>> +
>>> /* MC_CMD_GET_PHY_CFG_OUT msgresponse */
>>> #define MC_CMD_GET_PHY_CFG_OUT_LEN 72
>>> /* flags */
>>> @@ -5026,6 +5263,9 @@
>>> #define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_OFST 8
>>> #define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_LBN 21
>>> #define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_WIDTH 1
>>> +#define MC_CMD_PHY_CAP_200000FDX_OFST 8
>>> +#define MC_CMD_PHY_CAP_200000FDX_LBN 22
>>> +#define MC_CMD_PHY_CAP_200000FDX_WIDTH 1
>>> /* ?? */
>>> #define MC_CMD_GET_PHY_CFG_OUT_CHANNEL_OFST 12
>>> #define MC_CMD_GET_PHY_CFG_OUT_CHANNEL_LEN 4
>>> @@ -5084,7 +5324,7 @@
>>> #define MC_CMD_START_BIST 0x25
>>> #undef MC_CMD_0x25_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x25_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x25_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_START_BIST_IN msgrequest */
>>> #define MC_CMD_START_BIST_IN_LEN 4
>>> @@ -5124,7 +5364,7 @@
>>> #define MC_CMD_POLL_BIST 0x26
>>> #undef MC_CMD_0x26_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x26_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x26_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_POLL_BIST_IN msgrequest */
>>> #define MC_CMD_POLL_BIST_IN_LEN 0
>>> @@ -5320,6 +5560,53 @@
>>> /* MC_CMD_GET_LOOPBACK_MODES_IN msgrequest */
>>> #define MC_CMD_GET_LOOPBACK_MODES_IN_LEN 0
>>>
>>> +/* MC_CMD_GET_LOOPBACK_MODES_IN_V2 msgrequest */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_LEN 8
>>> +/* Target port to request loopback modes for. Uses MAE_LINK_ENDPOINT_SELECTOR
>>> + * which identifies a real or virtual network port by MAE port and link end.
>>> + * See the structure definition for more details
>>> + */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_OFST 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_OFST 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_LBN 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_OFST 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_LBN 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LINK_END_OFST 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LINK_END_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_OFST 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_OFST 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_LBN 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_OFST 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_LBN 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_WIDTH 32
>>> +
>>> /* MC_CMD_GET_LOOPBACK_MODES_OUT msgresponse */
>>> #define MC_CMD_GET_LOOPBACK_MODES_OUT_LEN 40
>>> /* Supported loopbacks. */
>>> @@ -5649,6 +5936,204 @@
>>> /* Enum values, see field(s): */
>>> /* 100M */
>>>
>>> +/* MC_CMD_GET_LOOPBACK_MODES_OUT_V3 msgresponse: Supported loopback modes for
>>> + * newer NICs with 200G support
>>> + */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_LEN 72
>>> +/* Supported loopbacks. */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_OFST 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_OFST 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_LBN 0
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_OFST 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_LBN 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_WIDTH 32
>>> +/* enum: None. */
>>> +/* MC_CMD_LOOPBACK_NONE 0x0 */
>>> +/* enum: Data. */
>>> +/* MC_CMD_LOOPBACK_DATA 0x1 */
>>> +/* enum: GMAC. */
>>> +/* MC_CMD_LOOPBACK_GMAC 0x2 */
>>> +/* enum: XGMII. */
>>> +/* MC_CMD_LOOPBACK_XGMII 0x3 */
>>> +/* enum: XGXS. */
>>> +/* MC_CMD_LOOPBACK_XGXS 0x4 */
>>> +/* enum: XAUI. */
>>> +/* MC_CMD_LOOPBACK_XAUI 0x5 */
>>> +/* enum: GMII. */
>>> +/* MC_CMD_LOOPBACK_GMII 0x6 */
>>> +/* enum: SGMII. */
>>> +/* MC_CMD_LOOPBACK_SGMII 0x7 */
>>> +/* enum: XGBR. */
>>> +/* MC_CMD_LOOPBACK_XGBR 0x8 */
>>> +/* enum: XFI. */
>>> +/* MC_CMD_LOOPBACK_XFI 0x9 */
>>> +/* enum: XAUI Far. */
>>> +/* MC_CMD_LOOPBACK_XAUI_FAR 0xa */
>>> +/* enum: GMII Far. */
>>> +/* MC_CMD_LOOPBACK_GMII_FAR 0xb */
>>> +/* enum: SGMII Far. */
>>> +/* MC_CMD_LOOPBACK_SGMII_FAR 0xc */
>>> +/* enum: XFI Far. */
>>> +/* MC_CMD_LOOPBACK_XFI_FAR 0xd */
>>> +/* enum: GPhy. */
>>> +/* MC_CMD_LOOPBACK_GPHY 0xe */
>>> +/* enum: PhyXS. */
>>> +/* MC_CMD_LOOPBACK_PHYXS 0xf */
>>> +/* enum: PCS. */
>>> +/* MC_CMD_LOOPBACK_PCS 0x10 */
>>> +/* enum: PMA-PMD. */
>>> +/* MC_CMD_LOOPBACK_PMAPMD 0x11 */
>>> +/* enum: Cross-Port. */
>>> +/* MC_CMD_LOOPBACK_XPORT 0x12 */
>>> +/* enum: XGMII-Wireside. */
>>> +/* MC_CMD_LOOPBACK_XGMII_WS 0x13 */
>>> +/* enum: XAUI Wireside. */
>>> +/* MC_CMD_LOOPBACK_XAUI_WS 0x14 */
>>> +/* enum: XAUI Wireside Far. */
>>> +/* MC_CMD_LOOPBACK_XAUI_WS_FAR 0x15 */
>>> +/* enum: XAUI Wireside near. */
>>> +/* MC_CMD_LOOPBACK_XAUI_WS_NEAR 0x16 */
>>> +/* enum: GMII Wireside. */
>>> +/* MC_CMD_LOOPBACK_GMII_WS 0x17 */
>>> +/* enum: XFI Wireside. */
>>> +/* MC_CMD_LOOPBACK_XFI_WS 0x18 */
>>> +/* enum: XFI Wireside Far. */
>>> +/* MC_CMD_LOOPBACK_XFI_WS_FAR 0x19 */
>>> +/* enum: PhyXS Wireside. */
>>> +/* MC_CMD_LOOPBACK_PHYXS_WS 0x1a */
>>> +/* enum: PMA lanes MAC-Serdes. */
>>> +/* MC_CMD_LOOPBACK_PMA_INT 0x1b */
>>> +/* enum: KR Serdes Parallel (Encoder). */
>>> +/* MC_CMD_LOOPBACK_SD_NEAR 0x1c */
>>> +/* enum: KR Serdes Serial. */
>>> +/* MC_CMD_LOOPBACK_SD_FAR 0x1d */
>>> +/* enum: PMA lanes MAC-Serdes Wireside. */
>>> +/* MC_CMD_LOOPBACK_PMA_INT_WS 0x1e */
>>> +/* enum: KR Serdes Parallel Wireside (Full PCS). */
>>> +/* MC_CMD_LOOPBACK_SD_FEP2_WS 0x1f */
>>> +/* enum: KR Serdes Parallel Wireside (Sym Aligner to TX). */
>>> +/* MC_CMD_LOOPBACK_SD_FEP1_5_WS 0x20 */
>>> +/* enum: KR Serdes Parallel Wireside (Deserializer to Serializer). */
>>> +/* MC_CMD_LOOPBACK_SD_FEP_WS 0x21 */
>>> +/* enum: KR Serdes Serial Wireside. */
>>> +/* MC_CMD_LOOPBACK_SD_FES_WS 0x22 */
>>> +/* enum: Near side of AOE Siena side port */
>>> +/* MC_CMD_LOOPBACK_AOE_INT_NEAR 0x23 */
>>> +/* enum: Medford Wireside datapath loopback */
>>> +/* MC_CMD_LOOPBACK_DATA_WS 0x24 */
>>> +/* enum: Force link up without setting up any physical loopback (snapper use
>>> + * only)
>>> + */
>>> +/* MC_CMD_LOOPBACK_FORCE_EXT_LINK 0x25 */
>>> +/* Supported loopbacks. */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_OFST 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_OFST 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_LBN 64
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_OFST 12
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_LBN 96
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_WIDTH 32
>>> +/* Enum values, see field(s): */
>>> +/* 100M */
>>> +/* Supported loopbacks. */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_OFST 16
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_OFST 16
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_LBN 128
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_OFST 20
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_LBN 160
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_WIDTH 32
>>> +/* Enum values, see field(s): */
>>> +/* 100M */
>>> +/* Supported loopbacks. */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_OFST 24
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_OFST 24
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_LBN 192
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_OFST 28
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_LBN 224
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_WIDTH 32
>>> +/* Enum values, see field(s): */
>>> +/* 100M */
>>> +/* Supported loopbacks. */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_OFST 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_OFST 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_LBN 256
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_OFST 36
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_LBN 288
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_WIDTH 32
>>> +/* Enum values, see field(s): */
>>> +/* 100M */
>>> +/* Supported 25G loopbacks. */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_OFST 40
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_OFST 40
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_LBN 320
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_OFST 44
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_LBN 352
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_WIDTH 32
>>> +/* Enum values, see field(s): */
>>> +/* 100M */
>>> +/* Supported 50 loopbacks. */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_OFST 48
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_OFST 48
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_LBN 384
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_OFST 52
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_LBN 416
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_WIDTH 32
>>> +/* Enum values, see field(s): */
>>> +/* 100M */
>>> +/* Supported 100G loopbacks. */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_OFST 56
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_OFST 56
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_LBN 448
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_OFST 60
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_LBN 480
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_WIDTH 32
>>> +/* Enum values, see field(s): */
>>> +/* 100M */
>>> +/* Supported 200G loopbacks. */
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_OFST 64
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LEN 8
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_OFST 64
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_LBN 512
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_WIDTH 32
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_OFST 68
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_LEN 4
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_LBN 544
>>> +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_WIDTH 32
>>> +/* Enum values, see field(s): */
>>> +/* 100M */
>>> +
>>> /* AN_TYPE structuredef: Auto-negotiation types defined in IEEE802.3 */
>>> #define AN_TYPE_LEN 4
>>> #define AN_TYPE_TYPE_OFST 0
>>> @@ -5694,6 +6179,53 @@
>>> /* MC_CMD_GET_LINK_IN msgrequest */
>>> #define MC_CMD_GET_LINK_IN_LEN 0
>>>
>>> +/* MC_CMD_GET_LINK_IN_V2 msgrequest */
>>> +#define MC_CMD_GET_LINK_IN_V2_LEN 8
>>> +/* Target port to request link state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
>>> + * identifies a real or virtual network port by MAE port and link end. See the
>>> + * structure definition for more details.
>>> + */
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_OFST 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_LEN 8
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_OFST 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_LEN 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_LBN 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_WIDTH 32
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_OFST 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_LEN 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_LBN 32
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_WIDTH 32
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_LINK_END_OFST 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_LINK_END_LEN 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_OFST 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LEN 8
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_OFST 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_LEN 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_LBN 0
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_WIDTH 32
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_OFST 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_LEN 4
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_LBN 32
>>> +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_WIDTH 32
>>> +
>>> /* MC_CMD_GET_LINK_OUT msgresponse */
>>> #define MC_CMD_GET_LINK_OUT_LEN 28
>>> /* Near-side advertised capabilities. Refer to
>>> @@ -5969,6 +6501,94 @@
>>> #define MC_CMD_SET_LINK_IN_V2_MODULE_SEQ_IGNORE_LBN 7
>>> #define MC_CMD_SET_LINK_IN_V2_MODULE_SEQ_IGNORE_WIDTH 1
>>>
>>> +/* MC_CMD_SET_LINK_IN_V3 msgrequest */
>>> +#define MC_CMD_SET_LINK_IN_V3_LEN 28
>>> +/* Near-side advertised capabilities. Refer to
>>> + * MC_CMD_GET_PHY_CFG_OUT/SUPPORTED_CAP for bit definitions.
>>> + */
>>> +#define MC_CMD_SET_LINK_IN_V3_CAP_OFST 0
>>> +#define MC_CMD_SET_LINK_IN_V3_CAP_LEN 4
>>> +/* Flags */
>>> +#define MC_CMD_SET_LINK_IN_V3_FLAGS_OFST 4
>>> +#define MC_CMD_SET_LINK_IN_V3_FLAGS_LEN 4
>>> +#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_OFST 4
>>> +#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_LBN 0
>>> +#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_WIDTH 1
>>> +#define MC_CMD_SET_LINK_IN_V3_POWEROFF_OFST 4
>>> +#define MC_CMD_SET_LINK_IN_V3_POWEROFF_LBN 1
>>> +#define MC_CMD_SET_LINK_IN_V3_POWEROFF_WIDTH 1
>>> +#define MC_CMD_SET_LINK_IN_V3_TXDIS_OFST 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TXDIS_LBN 2
>>> +#define MC_CMD_SET_LINK_IN_V3_TXDIS_WIDTH 1
>>> +#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_OFST 4
>>> +#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_LBN 3
>>> +#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_WIDTH 1
>>> +/* Loopback mode. */
>>> +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_MODE_OFST 8
>>> +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_MODE_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MC_CMD_GET_LOOPBACK_MODES/MC_CMD_GET_LOOPBACK_MODES_OUT/100M */
>>> +/* A loopback speed of "0" is supported, and means (choose any available
>>> + * speed).
>>> + */
>>> +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_SPEED_OFST 12
>>> +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_SPEED_LEN 4
>>> +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_OFST 16
>>> +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_LEN 1
>>> +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_OFST 16
>>> +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_LBN 0
>>> +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_WIDTH 7
>>> +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_OFST 16
>>> +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_LBN 7
>>> +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_WIDTH 1
>>> +/* Padding */
>>> +#define MC_CMD_SET_LINK_IN_V3_RESERVED_OFST 17
>>> +#define MC_CMD_SET_LINK_IN_V3_RESERVED_LEN 3
>>> +/* Target port to set link state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
>>> + * identifies a real or virtual network port by MAE port and link end. See the
>>> + * structure definition for more details
>>> + */
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_OFST 20
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_LEN 8
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_OFST 20
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_LEN 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_LBN 160
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_WIDTH 32
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_OFST 24
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_LEN 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_LBN 192
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_WIDTH 32
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_OFST 20
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_LEN 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FLAT_OFST 20
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FLAT_LEN 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_TYPE_OFST 23
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_TYPE_LEN 1
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 20
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 160
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 180
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 176
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 22
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 20
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_LINK_END_OFST 24
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_LINK_END_LEN 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_OFST 20
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LEN 8
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_OFST 20
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_LEN 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_LBN 160
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_WIDTH 32
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_OFST 24
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_LEN 4
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_LBN 192
>>> +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_WIDTH 32
>>> +
>>> /* MC_CMD_SET_LINK_OUT msgresponse */
>>> #define MC_CMD_SET_LINK_OUT_LEN 0
>>>
>>> @@ -6188,19 +6808,9 @@
>>> #define MC_CMD_SET_MAC_V3_IN_CFG_FCS_OFST 28
>>> #define MC_CMD_SET_MAC_V3_IN_CFG_FCS_LBN 4
>>> #define MC_CMD_SET_MAC_V3_IN_CFG_FCS_WIDTH 1
>>> -/* Identifies the MAC to update by the specifying the end of a logical MAE
>>> - * link. Setting TARGET to MAE_LINK_ENDPOINT_COMPAT is equivalent to using the
>>> - * previous version of the command (MC_CMD_SET_MAC_EXT). Not all possible
>>> - * combinations of MPORT_END and MPORT_SELECTOR in TARGET will work in all
>>> - * circumstances. 1. Some will always work (e.g. a VF can always address its
>>> - * logical MAC using MPORT_SELECTOR=ASSIGNED,LINK_END=VNIC), 2. Some are not
>>> - * meaningful and will always fail with EINVAL (e.g. attempting to address the
>>> - * VNIC end of a link to a physical port), 3. Some are meaningful but require
>>> - * the MCDI client to have the required permission and fail with EPERM
>>> - * otherwise (e.g. trying to set the MAC on a VF the caller cannot administer),
>>> - * and 4. Some could be implementation-specific and fail with ENOTSUP if not
>>> - * available (no examples exist right now). See SF-123581-TC section 4.3 for
>>> - * more details.
>>> +/* Target port to set mac state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
>>> + * identifies a real or virtual network port by MAE port and link end. See the
>>> + * structure definition for more details
>>> */
>>> #define MC_CMD_SET_MAC_V3_IN_TARGET_OFST 32
>>> #define MC_CMD_SET_MAC_V3_IN_TARGET_LEN 8
>>> @@ -6405,6 +7015,97 @@
>>> #define MC_CMD_MAC_STATS_IN_PORT_ID_OFST 16
>>> #define MC_CMD_MAC_STATS_IN_PORT_ID_LEN 4
>>>
>>> +/* MC_CMD_MAC_STATS_V2_IN msgrequest */
>>> +#define MC_CMD_MAC_STATS_V2_IN_LEN 28
>>> +/* ??? */
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_OFST 0
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LEN 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_OFST 0
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_LEN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_LBN 0
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_WIDTH 32
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_OFST 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_LEN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_LBN 32
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_WIDTH 32
>>> +#define MC_CMD_MAC_STATS_V2_IN_CMD_OFST 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_CMD_LEN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_OFST 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_LBN 0
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_WIDTH 1
>>> +#define MC_CMD_MAC_STATS_V2_IN_CLEAR_OFST 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_CLEAR_LBN 1
>>> +#define MC_CMD_MAC_STATS_V2_IN_CLEAR_WIDTH 1
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_OFST 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_LBN 2
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_WIDTH 1
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_OFST 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_LBN 3
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_WIDTH 1
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_OFST 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_LBN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_WIDTH 1
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_OFST 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_LBN 5
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_WIDTH 1
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_OFST 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_LBN 16
>>> +#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_WIDTH 16
>>> +/* DMA length. Should be set to MAC_STATS_NUM_STATS * sizeof(uint64_t), as
>>> + * returned by MC_CMD_GET_CAPABILITIES_V4_OUT. For legacy firmware not
>>> + * supporting MC_CMD_GET_CAPABILITIES_V4_OUT, DMA_LEN should be set to
>>> + * MC_CMD_MAC_NSTATS * sizeof(uint64_t)
>>> + */
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_LEN_OFST 12
>>> +#define MC_CMD_MAC_STATS_V2_IN_DMA_LEN_LEN 4
>>> +/* port id so vadapter stats can be provided */
>>> +#define MC_CMD_MAC_STATS_V2_IN_PORT_ID_OFST 16
>>> +#define MC_CMD_MAC_STATS_V2_IN_PORT_ID_LEN 4
>>> +/* Target port to request statistics for. Uses MAE_LINK_ENDPOINT_SELECTOR which
>>> + * identifies a real or virtual network port by MAE port and link end. See the
>>> + * structure definition for more details
>>> + */
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_OFST 20
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LEN 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_OFST 20
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_LEN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_LBN 160
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_WIDTH 32
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_OFST 24
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_LEN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_LBN 192
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_WIDTH 32
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_OFST 20
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_LEN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FLAT_OFST 20
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FLAT_LEN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_TYPE_OFST 23
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_TYPE_LEN 1
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 20
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 160
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 180
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 176
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 22
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 20
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LINK_END_OFST 24
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LINK_END_LEN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_OFST 20
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LEN 8
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_OFST 20
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_LEN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_LBN 160
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_WIDTH 32
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_OFST 24
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_LEN 4
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_LBN 192
>>> +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_WIDTH 32
>>> +
>>> /* MC_CMD_MAC_STATS_OUT_DMA msgresponse */
>>> #define MC_CMD_MAC_STATS_OUT_DMA_LEN 0
>>>
>>> @@ -7522,7 +8223,7 @@
>>> #define MC_CMD_REBOOT 0x3d
>>> #undef MC_CMD_0x3d_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x3d_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x3d_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_REBOOT_IN msgrequest */
>>> #define MC_CMD_REBOOT_IN_LEN 4
>>> @@ -8061,6 +8762,53 @@
>>> /* MC_CMD_GET_PHY_STATE_IN msgrequest */
>>> #define MC_CMD_GET_PHY_STATE_IN_LEN 0
>>>
>>> +/* MC_CMD_GET_PHY_STATE_IN_V2 msgrequest */
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_LEN 8
>>> +/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
>>> + * identifies a real or virtual network port by MAE port and link end. See the
>>> + * structure definition for more details.
>>> + */
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_OFST 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LEN 8
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_OFST 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_LEN 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_LBN 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_WIDTH 32
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_OFST 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_LEN 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_LBN 32
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_WIDTH 32
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LINK_END_OFST 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LINK_END_LEN 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_OFST 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LEN 8
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_OFST 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_LEN 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_LBN 0
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_WIDTH 32
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_OFST 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_LEN 4
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_LBN 32
>>> +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_WIDTH 32
>>> +
>>> /* MC_CMD_GET_PHY_STATE_OUT msgresponse */
>>> #define MC_CMD_GET_PHY_STATE_OUT_LEN 4
>>> #define MC_CMD_GET_PHY_STATE_OUT_STATE_OFST 0
>>> @@ -8200,7 +8948,7 @@
>>> #define MC_CMD_TESTASSERT 0x49
>>> #undef MC_CMD_0x49_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x49_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x49_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_TESTASSERT_IN msgrequest */
>>> #define MC_CMD_TESTASSERT_IN_LEN 0
>>> @@ -8324,6 +9072,61 @@
>>> #define MC_CMD_GET_PHY_MEDIA_INFO_IN_DSFP_BANK_LBN 16
>>> #define MC_CMD_GET_PHY_MEDIA_INFO_IN_DSFP_BANK_WIDTH 16
>>>
>>> +/* MC_CMD_GET_PHY_MEDIA_INFO_IN_V2 msgrequest */
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_LEN 12
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_PAGE_OFST 0
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_PAGE_LEN 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_OFST 0
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_LBN 0
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_WIDTH 16
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_OFST 0
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_LBN 16
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_WIDTH 16
>>> +/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
>>> + * identifies a real or virtual network port by MAE port and link end. See the
>>> + * structure definition for more details
>>> + */
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_OFST 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LEN 8
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_OFST 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_LEN 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_LBN 32
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_WIDTH 32
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_OFST 8
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_LEN 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_LBN 64
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_WIDTH 32
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_OFST 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 7
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 32
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 52
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 48
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 6
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LINK_END_OFST 8
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LINK_END_LEN 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_OFST 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LEN 8
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_OFST 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_LEN 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_LBN 32
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_WIDTH 32
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_OFST 8
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_LEN 4
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_LBN 64
>>> +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_WIDTH 32
>>> +
>>> /* MC_CMD_GET_PHY_MEDIA_INFO_OUT msgresponse */
>>> #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMIN 5
>>> #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMAX 252
>>> @@ -8348,7 +9151,7 @@
>>> #define MC_CMD_NVRAM_TEST 0x4c
>>> #undef MC_CMD_0x4c_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x4c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x4c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_NVRAM_TEST_IN msgrequest */
>>> #define MC_CMD_NVRAM_TEST_IN_LEN 4
>>> @@ -8593,7 +9396,7 @@
>>> #define MC_CMD_CLP 0x56
>>> #undef MC_CMD_0x56_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x56_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x56_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_CLP_IN msgrequest */
>>> #define MC_CMD_CLP_IN_LEN 4
>>> @@ -9500,27 +10303,22 @@
>>> * and a generation count for this version of the sensor table. On systems
>>> * advertising the DYNAMIC_SENSORS capability bit, this replaces the
>>> * MC_CMD_READ_SENSORS command. On multi-MC systems this may include sensors
>>> - * added by the NMC.
>>> - *
>>> - * Sensor handles are persistent for the lifetime of the sensor and are used to
>>> - * identify sensors in MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS and
>>> - * MC_CMD_DYNAMIC_SENSORS_GET_VALUES.
>>> - *
>>> - * The generation count is maintained by the MC, is persistent across reboots
>>> - * and will be incremented each time the sensor table is modified. When the
>>> - * table is modified, a CODE_DYNAMIC_SENSORS_CHANGE event will be generated
>>> - * containing the new generation count. The driver should compare this against
>>> - * the current generation count, and if it is different, call
>>> - * MC_CMD_DYNAMIC_SENSORS_LIST again to update it's copy of the sensor table.
>>> - *
>>> - * The sensor count is provided to allow a future path to supporting more than
>>> + * added by the NMC. Sensor handles are persistent for the lifetime of the
>>> + * sensor and are used to identify sensors in
>>> + * MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS and
>>> + * MC_CMD_DYNAMIC_SENSORS_GET_VALUES. The generation count is maintained by the
>>> + * MC, is persistent across reboots and will be incremented each time the
>>> + * sensor table is modified. When the table is modified, a
>>> + * CODE_DYNAMIC_SENSORS_CHANGE event will be generated containing the new
>>> + * generation count. The driver should compare this against the current
>>> + * generation count, and if it is different, call MC_CMD_DYNAMIC_SENSORS_LIST
>>> + * again to update it's copy of the sensor table. The sensor count is provided
>>> + * to allow a future path to supporting more than
>>> * MC_CMD_DYNAMIC_SENSORS_GET_READINGS_IN_HANDLES_MAXNUM_MCDI2 sensors, i.e.
>>> * the maximum number that will fit in a single response. As this is a fairly
>>> * large number (253) it is not anticipated that this will be needed in the
>>> - * near future, so can currently be ignored.
>>> - *
>>> - * On Riverhead this command is implemented as a wrapper for `list` in the
>>> - * sensor_query SPHINX service.
>>> + * near future, so can currently be ignored. On Riverhead this command is
>>> + * implemented as a wrapper for `list` in the sensor_query SPHINX service.
>>> */
>>> #define MC_CMD_DYNAMIC_SENSORS_LIST 0x66
>>> #undef MC_CMD_0x66_PRIVILEGE_CTG
>>> @@ -9557,15 +10355,13 @@
>>> /***********************************/
>>> /* MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS
>>> * Get descriptions for a set of sensors, specified as an array of sensor
>>> - * handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST
>>> - *
>>> - * Any handles which do not correspond to a sensor currently managed by the MC
>>> - * will be dropped from from the response. This may happen when a sensor table
>>> - * update is in progress, and effectively means the set of usable sensors is
>>> - * the intersection between the sets of sensors known to the driver and the MC.
>>> - *
>>> - * On Riverhead this command is implemented as a wrapper for
>>> - * `get_descriptions` in the sensor_query SPHINX service.
>>> + * handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST. Any handles which do not
>>> + * correspond to a sensor currently managed by the MC will be dropped from from
>>> + * the response. This may happen when a sensor table update is in progress, and
>>> + * effectively means the set of usable sensors is the intersection between the
>>> + * sets of sensors known to the driver and the MC. On Riverhead this command is
>>> + * implemented as a wrapper for `get_descriptions` in the sensor_query SPHINX
>>> + * service.
>>> */
>>> #define MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS 0x67
>>> #undef MC_CMD_0x67_PRIVILEGE_CTG
>>> @@ -9602,19 +10398,15 @@
>>> /***********************************/
>>> /* MC_CMD_DYNAMIC_SENSORS_GET_READINGS
>>> * Read the state and value for a set of sensors, specified as an array of
>>> - * sensor handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST.
>>> - *
>>> - * In the case of a broken sensor, then the state of the response's
>>> - * MC_CMD_DYNAMIC_SENSORS_VALUE entry will be set to BROKEN, and any value
>>> - * provided should be treated as erroneous.
>>> - *
>>> - * Any handles which do not correspond to a sensor currently managed by the MC
>>> - * will be dropped from from the response. This may happen when a sensor table
>>> - * update is in progress, and effectively means the set of usable sensors is
>>> - * the intersection between the sets of sensors known to the driver and the MC.
>>> - *
>>> - * On Riverhead this command is implemented as a wrapper for `get_readings`
>>> - * in the sensor_query SPHINX service.
>>> + * sensor handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST. In the case of a
>>> + * broken sensor, then the state of the response's MC_CMD_DYNAMIC_SENSORS_VALUE
>>> + * entry will be set to BROKEN, and any value provided should be treated as
>>> + * erroneous. Any handles which do not correspond to a sensor currently managed
>>> + * by the MC will be dropped from from the response. This may happen when a
>>> + * sensor table update is in progress, and effectively means the set of usable
>>> + * sensors is the intersection between the sets of sensors known to the driver
>>> + * and the MC. On Riverhead this command is implemented as a wrapper for
>>> + * `get_readings` in the sensor_query SPHINX service.
>>> */
>>> #define MC_CMD_DYNAMIC_SENSORS_GET_READINGS 0x68
>>> #undef MC_CMD_0x68_PRIVILEGE_CTG
>>> @@ -10212,6 +11004,42 @@
>>> #define CTPIO_STATS_MAP_BUCKET_LBN 16
>>> #define CTPIO_STATS_MAP_BUCKET_WIDTH 16
>>>
>>> +/* MESSAGE_TYPE structuredef: When present this defines the meaning of a
>>> + * message, and is used to protect against chosen message attacks in signed
>>> + * messages, regardless their origin. The message type also defines the
>>> + * signature cryptographic algorithm, encoding, and message fields included in
>>> + * the signature. The values are used in different commands but must be unique
>>> + * across all commands, e.g. MC_CMD_TSA_BIND_IN_SECURE_UNBIND uses different
>>> + * message type than MC_CMD_SECURE_NIC_INFO_IN_STATUS.
>>> + */
>>> +#define MESSAGE_TYPE_LEN 4
>>> +#define MESSAGE_TYPE_MESSAGE_TYPE_OFST 0
>>> +#define MESSAGE_TYPE_MESSAGE_TYPE_LEN 4
>>> +#define MESSAGE_TYPE_UNUSED 0x0 /* enum */
>>> +/* enum: Message type value for the response to a
>>> + * MC_CMD_TSA_BIND_IN_SECURE_UNBIND message. TSA_SECURE_UNBIND messages are
>>> + * ECDSA SECP384R1 signed using SHA384 message digest algorithm over fields
>>> + * MESSAGE_TYPE, TSANID, TSAID, and UNBINDTOKEN, and encoded as suggested by
>>> + * RFC6979 (section 2.4).
>>> + */
>>> +#define MESSAGE_TYPE_TSA_SECURE_UNBIND 0x1
>>> +/* enum: Message type value for the response to a
>>> + * MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION message. TSA_SECURE_DECOMMISSION
>>> + * messages are ECDSA SECP384R1 signed using SHA384 message digest algorithm
>>> + * over fields MESSAGE_TYPE, TSAID, USER, and REASON, and encoded as suggested
>>> + * by RFC6979 (section 2.4).
>>> + */
>>> +#define MESSAGE_TYPE_TSA_SECURE_DECOMMISSION 0x2
>>> +/* enum: Message type value for the response to a
>>> + * MC_CMD_SECURE_NIC_INFO_IN_STATUS message. This enum value is not sequential
>>> + * to other message types for backwards compatibility as the message type for
>>> + * MC_CMD_SECURE_NIC_INFO_IN_STATUS was defined before the existence of this
>>> + * global enum.
>>> + */
>>> +#define MESSAGE_TYPE_SECURE_NIC_INFO_STATUS 0xdb4
>>> +#define MESSAGE_TYPE_MESSAGE_TYPE_LBN 0
>>> +#define MESSAGE_TYPE_MESSAGE_TYPE_WIDTH 32
>>> +
>>>
>>> /***********************************/
>>> /* MC_CMD_READ_REGS
>>> @@ -12860,6 +13688,48 @@
>>> #define MC_CMD_GET_PARSER_DISP_RESTRICTIONS_OUT_DST_IP_MCAST_ONLY_LBN 0
>>> #define MC_CMD_GET_PARSER_DISP_RESTRICTIONS_OUT_DST_IP_MCAST_ONLY_WIDTH 1
>>>
>>> +/* MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT msgresponse:
>>> + * GET_PARSER_DISP_INFO response format for OP_GET_SECURITY_RULE_INFO.
>>> + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
>>> + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
>>> + * been used in any released code and may change during development. This note
>>> + * will be removed once it is regarded as stable.
>>> + */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_LEN 36
>>> +/* identifies the type of operation requested */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_OP_OFST 0
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_OP_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MC_CMD_GET_PARSER_DISP_INFO_IN/OP */
>>> +/* a version number representing the set of rule lookups that are implemented
>>> + * by the currently running firmware
>>> + */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_OFST 4
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_LEN 4
>>> +/* enum: implements lookup sequences described in SF-114946-SW draft C */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_SF_114946_SW_C 0x0
>>> +/* the number of nodes in the subnet map */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_NODES_OFST 8
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_NODES_LEN 4
>>> +/* the number of entries in one subnet map node */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_ENTRIES_PER_NODE_OFST 12
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_ENTRIES_PER_NODE_LEN 4
>>> +/* minimum valid value for a subnet ID in a subnet map leaf */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MIN_OFST 16
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MIN_LEN 4
>>> +/* maximum valid value for a subnet ID in a subnet map leaf */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MAX_OFST 20
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MAX_LEN 4
>>> +/* the number of entries in the local and remote port range maps */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_TREE_NUM_ENTRIES_OFST 24
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_TREE_NUM_ENTRIES_LEN 4
>>> +/* minimum valid value for a portrange ID in a port range map leaf */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MIN_OFST 28
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MIN_LEN 4
>>> +/* maximum valid value for a portrange ID in a port range map leaf */
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MAX_OFST 32
>>> +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MAX_LEN 4
>>> +
>>> /* MC_CMD_GET_PARSER_DISP_VNIC_ENCAP_MATCHES_OUT msgresponse: This response is
>>> * returned if a MC_CMD_GET_PARSER_DISP_INFO_IN request is sent with OP value
>>> * OP_GET_SUPPORTED_VNIC_ENCAP_MATCHES. It contains information about the
>>> @@ -13716,7 +14586,7 @@
>>> #define MC_CMD_SATELLITE_DOWNLOAD 0x91
>>> #undef MC_CMD_0x91_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x91_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x91_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_SATELLITE_DOWNLOAD_IN msgrequest: The reset requirements for the CPUs
>>> * are subtle, and so downloads must proceed in a number of phases.
>>> @@ -13835,10 +14705,9 @@
>>>
>>> /***********************************/
>>> /* MC_CMD_GET_CAPABILITIES
>>> - * Get device capabilities.
>>> - *
>>> - * This is supplementary to the MC_CMD_GET_BOARD_CFG command, and intended to
>>> - * reference inherent device capabilities as opposed to current NVRAM config.
>>> + * Get device capabilities. This is supplementary to the MC_CMD_GET_BOARD_CFG
>>> + * command, and intended to reference inherent device capabilities as opposed
>>> + * to current NVRAM config.
>>> */
>>> #define MC_CMD_GET_CAPABILITIES 0xbe
>>> #undef MC_CMD_0xbe_PRIVILEGE_CTG
>>> @@ -16796,9 +17665,15 @@
>>> #define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
>>> #define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
>>> #define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
>>> +#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
>>> +#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
>>> +#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
>>> #define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
>>> #define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
>>> #define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
>>> +#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_OFST 148
>>> +#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_LBN 15
>>> +#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
>>>
>>> /* MC_CMD_GET_CAPABILITIES_V8_OUT msgresponse */
>>> #define MC_CMD_GET_CAPABILITIES_V8_OUT_LEN 160
>>> @@ -17300,9 +18175,15 @@
>>> #define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
>>> #define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
>>> #define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
>>> +#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
>>> +#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
>>> +#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
>>> #define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
>>> #define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
>>> #define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
>>> +#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_OFST 148
>>> +#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_LBN 15
>>> +#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
>>> /* These bits are reserved for communicating test-specific capabilities to
>>> * host-side test software. All production drivers should treat this field as
>>> * opaque.
>>> @@ -17818,9 +18699,15 @@
>>> #define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
>>> #define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
>>> #define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
>>> +#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
>>> +#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
>>> +#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
>>> #define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
>>> #define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
>>> #define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
>>> +#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_OFST 148
>>> +#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_LBN 15
>>> +#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
>>> /* These bits are reserved for communicating test-specific capabilities to
>>> * host-side test software. All production drivers should treat this field as
>>> * opaque.
>>> @@ -18371,9 +19258,15 @@
>>> #define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
>>> #define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
>>> #define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
>>> +#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
>>> +#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
>>> +#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
>>> #define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
>>> #define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
>>> #define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
>>> +#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_OFST 148
>>> +#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_LBN 15
>>> +#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
>>> /* These bits are reserved for communicating test-specific capabilities to
>>> * host-side test software. All production drivers should treat this field as
>>> * opaque.
>>> @@ -18468,6 +19361,13 @@
>>> * are not defined.
>>> */
>>> #define MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_TSA 0x1
>>> +/* enum: MCDI command used for platform management. Typically, these commands
>>> + * are used for low-level operations directed at the platform as a whole (e.g.
>>> + * MMIO device enumeration) rather than individual functions and use a
>>> + * dedicated comms channel (e.g. RPmsg/IPI). May be handled by the same or
>>> + * different CPU as MCDI_MESSAGE_TYPE_MC.
>>> + */
>>> +#define MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_PLATFORM 0x2
>>>
>>>
>>> /***********************************/
>>> @@ -20179,7 +21079,7 @@
>>> #define MC_CMD_SHMBOOT_OP 0xe6
>>> #undef MC_CMD_0xe6_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0xe6_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0xe6_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_SHMBOOT_OP_IN msgrequest */
>>> #define MC_CMD_SHMBOOT_OP_IN_LEN 4
>>> @@ -20448,7 +21348,7 @@
>>> #define MC_CMD_ENABLE_OFFLINE_BIST 0xed
>>> #undef MC_CMD_0xed_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0xed_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0xed_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_ENABLE_OFFLINE_BIST_IN msgrequest */
>>> #define MC_CMD_ENABLE_OFFLINE_BIST_IN_LEN 0
>>> @@ -20588,7 +21488,7 @@
>>> #define MC_CMD_KR_TUNE 0xf1
>>> #undef MC_CMD_0xf1_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0xf1_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0xf1_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_KR_TUNE_IN msgrequest */
>>> #define MC_CMD_KR_TUNE_IN_LENMIN 4
>>> @@ -21144,7 +22044,7 @@
>>> #define MC_CMD_PCIE_TUNE 0xf2
>>> #undef MC_CMD_0xf2_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0xf2_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0xf2_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_PCIE_TUNE_IN msgrequest */
>>> #define MC_CMD_PCIE_TUNE_IN_LENMIN 4
>>> @@ -21877,7 +22777,7 @@
>>> #define MC_CMD_LICENSING_V3_TEMPORARY 0xd6
>>> #undef MC_CMD_0xd6_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0xd6_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0xd6_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_LICENSING_V3_TEMPORARY_IN msgrequest */
>>> #define MC_CMD_LICENSING_V3_TEMPORARY_IN_LEN 4
>>> @@ -22305,8 +23205,8 @@
>>> * TLV_PORT_MODE_*). A superset of MC_CMD_GET_PORT_MODES_OUT/MODES that
>>> * contains all modes implemented in firmware for a particular board. Modes
>>> * listed in MODES are considered production modes and should be exposed in
>>> - * userland tools. Modes listed in ENGINEERING_MODES, but not in MODES
>>> - * should be considered hidden (not to be exposed in userland tools) and for
>>> + * userland tools. Modes listed in ENGINEERING_MODES, but not in MODES should
>>> + * be considered hidden (not to be exposed in userland tools) and for
>>> * engineering use only. There are no other semantic differences and any mode
>>> * listed in either MODES or ENGINEERING_MODES can be set on the board.
>>> */
>>> @@ -22937,7 +23837,7 @@
>>> #define MC_CMD_EXEC_SIGNED 0x10c
>>> #undef MC_CMD_0x10c_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x10c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x10c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_EXEC_SIGNED_IN msgrequest */
>>> #define MC_CMD_EXEC_SIGNED_IN_LEN 28
>>> @@ -22967,7 +23867,7 @@
>>> #define MC_CMD_PREPARE_SIGNED 0x10d
>>> #undef MC_CMD_0x10d_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x10d_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x10d_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_PREPARE_SIGNED_IN msgrequest */
>>> #define MC_CMD_PREPARE_SIGNED_IN_LEN 4
>>> @@ -22979,6 +23879,445 @@
>>> #define MC_CMD_PREPARE_SIGNED_OUT_LEN 0
>>>
>>>
>>> +/***********************************/
>>> +/* MC_CMD_SET_SECURITY_RULE
>>> + * Set blacklist and/or whitelist action for a particular match criteria.
>>> + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
>>> + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
>>> + * been used in any released code and may change during development. This note
>>> + * will be removed once it is regarded as stable.
>>> + */
>>> +#define MC_CMD_SET_SECURITY_RULE 0x10f
>>> +#undef MC_CMD_0x10f_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x10f_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_SET_SECURITY_RULE_IN msgrequest */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_LEN 92
>>> +/* fields to include in match criteria */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_FIELDS_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_FIELDS_LEN 4
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_LBN 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_LBN 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_LBN 2
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_LBN 3
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_LBN 4
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_LBN 5
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_LBN 6
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_LBN 7
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_LBN 8
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_LBN 9
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_LBN 10
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_LBN 11
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_LBN 12
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_LBN 13
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_LBN 14
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_WIDTH 1
>>> +/* remote MAC address to match (as bytes in network order) */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_MAC_OFST 4
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_MAC_LEN 6
>>> +/* remote port to match (as bytes in network order) */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORT_OFST 10
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORT_LEN 2
>>> +/* local MAC address to match (as bytes in network order) */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_MAC_OFST 12
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_MAC_LEN 6
>>> +/* local port to match (as bytes in network order) */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORT_OFST 18
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORT_LEN 2
>>> +/* Ethernet type to match (as bytes in network order) */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_ETHER_TYPE_OFST 20
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_ETHER_TYPE_LEN 2
>>> +/* Inner VLAN tag to match (as bytes in network order) */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_INNER_VLAN_OFST 22
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_INNER_VLAN_LEN 2
>>> +/* Outer VLAN tag to match (as bytes in network order) */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_OUTER_VLAN_OFST 24
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_OUTER_VLAN_LEN 2
>>> +/* IP protocol to match (in low byte; set high byte to 0) */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_IP_PROTO_OFST 26
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_IP_PROTO_LEN 2
>>> +/* Physical port to match (as little-endian 32-bit value) */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_PHYSICAL_PORT_OFST 28
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_PHYSICAL_PORT_LEN 4
>>> +/* Reserved; set to 0 */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_RESERVED_OFST 32
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_RESERVED_LEN 4
>>> +/* remote IP address to match (as bytes in network order; set last 12 bytes to
>>> + * 0 for IPv4 address)
>>> + */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_IP_OFST 36
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_IP_LEN 16
>>> +/* local IP address to match (as bytes in network order; set last 12 bytes to 0
>>> + * for IPv4 address)
>>> + */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_IP_OFST 52
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_IP_LEN 16
>>> +/* remote subnet ID to match (as little-endian 32-bit value); note that remote
>>> + * subnets are matched by mapping the remote IP address to a "subnet ID" via a
>>> + * data structure which must already have been configured using
>>> + * MC_CMD_SUBNET_MAP_SET_NODE appropriately
>>> + */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_SUBNET_ID_OFST 68
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_SUBNET_ID_LEN 4
>>> +/* remote portrange ID to match (as little-endian 32-bit value); note that
>>> + * remote port ranges are matched by mapping the remote port to a "portrange
>>> + * ID" via a data structure which must already have been configured using
>>> + * MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE
>>> + */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORTRANGE_ID_OFST 72
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORTRANGE_ID_LEN 4
>>> +/* local portrange ID to match (as little-endian 32-bit value); note that local
>>> + * port ranges are matched by mapping the local port to a "portrange ID" via a
>>> + * data structure which must already have been configured using
>>> + * MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE
>>> + */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORTRANGE_ID_OFST 76
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORTRANGE_ID_LEN 4
>>> +/* set the action for transmitted packets matching this rule */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_OFST 80
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_LEN 4
>>> +/* enum: make no decision */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_NONE 0x0
>>> +/* enum: decide to accept the packet */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_WHITELIST 0x1
>>> +/* enum: decide to drop the packet */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_BLACKLIST 0x2
>>> +/* enum: inform the TSA controller about some sample of packets matching this
>>> + * rule (via MC_CMD_TSA_INFO_IN_PKT_SAMPLE messages); may be bitwise-ORed with
>>> + * either the WHITELIST or BLACKLIST action
>>> + */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_SAMPLE 0x4
>>> +/* enum: do not change the current TX action */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_UNCHANGED 0xffffffff
>>> +/* set the action for received packets matching this rule */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_OFST 84
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_LEN 4
>>> +/* enum: make no decision */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_NONE 0x0
>>> +/* enum: decide to accept the packet */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_WHITELIST 0x1
>>> +/* enum: decide to drop the packet */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_BLACKLIST 0x2
>>> +/* enum: inform the TSA controller about some sample of packets matching this
>>> + * rule (via MC_CMD_TSA_INFO_IN_PKT_SAMPLE messages); may be bitwise-ORed with
>>> + * either the WHITELIST or BLACKLIST action
>>> + */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_SAMPLE 0x4
>>> +/* enum: do not change the current RX action */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_UNCHANGED 0xffffffff
>>> +/* counter ID to associate with this rule; IDs are allocated using
>>> + * MC_CMD_SECURITY_RULE_COUNTER_ALLOC
>>> + */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_OFST 88
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_LEN 4
>>> +/* enum: special value for the null counter ID */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_NONE 0x0
>>> +/* enum: special value to tell the MC to allocate an available counter */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_SW_AUTO 0xeeeeeeee
>>> +/* enum: special value to request use of hardware counter (Medford2 only) */
>>> +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_HW 0xffffffff
>>> +
>>> +/* MC_CMD_SET_SECURITY_RULE_OUT msgresponse */
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_LEN 32
>>> +/* new reference count for uses of counter ID */
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_REFCNT_OFST 0
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_REFCNT_LEN 4
>>> +/* constructed match bits for this rule (as a tracing aid only) */
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_MATCH_BITS_OFST 4
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_MATCH_BITS_LEN 12
>>> +/* constructed discriminator bits for this rule (as a tracing aid only) */
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_DISCRIMINATOR_OFST 16
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_DISCRIMINATOR_LEN 4
>>> +/* base location for probes for this rule (as a tracing aid only) */
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_BASE_OFST 20
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_BASE_LEN 4
>>> +/* step for probes for this rule (as a tracing aid only) */
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_STEP_OFST 24
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_STEP_LEN 4
>>> +/* ID for reading back the counter */
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_ID_OFST 28
>>> +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_ID_LEN 4
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_RESET_SECURITY_RULES
>>> + * Reset all blacklist and whitelist actions for a particular physical port, or
>>> + * all ports. (Medford-only; for use by SolarSecure apps, not directly by
>>> + * drivers. See SF-114946-SW.) NOTE - this message definition is provisional.
>>> + * It has not yet been used in any released code and may change during
>>> + * development. This note will be removed once it is regarded as stable.
>>> + */
>>> +#define MC_CMD_RESET_SECURITY_RULES 0x110
>>> +#undef MC_CMD_0x110_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x110_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_RESET_SECURITY_RULES_IN msgrequest */
>>> +#define MC_CMD_RESET_SECURITY_RULES_IN_LEN 4
>>> +/* index of physical port to reset (or ALL_PHYSICAL_PORTS to reset all) */
>>> +#define MC_CMD_RESET_SECURITY_RULES_IN_PHYSICAL_PORT_OFST 0
>>> +#define MC_CMD_RESET_SECURITY_RULES_IN_PHYSICAL_PORT_LEN 4
>>> +/* enum: special value to reset all physical ports */
>>> +#define MC_CMD_RESET_SECURITY_RULES_IN_ALL_PHYSICAL_PORTS 0xffffffff
>>> +
>>> +/* MC_CMD_RESET_SECURITY_RULES_OUT msgresponse */
>>> +#define MC_CMD_RESET_SECURITY_RULES_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_GET_SECURITY_RULESET_VERSION
>>> + * Return a large hash value representing a "version" of the complete set of
>>> + * currently active blacklist / whitelist rules and associated data structures.
>>> + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
>>> + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
>>> + * been used in any released code and may change during development. This note
>>> + * will be removed once it is regarded as stable.
>>> + */
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION 0x111
>>> +#undef MC_CMD_0x111_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x111_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_GET_SECURITY_RULESET_VERSION_IN msgrequest */
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_IN_LEN 0
>>> +
>>> +/* MC_CMD_GET_SECURITY_RULESET_VERSION_OUT msgresponse */
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMIN 1
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMAX 252
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMAX_MCDI2 1020
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LEN(num) (0+1*(num))
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_NUM(len) (((len)-0)/1)
>>> +/* Opaque hash value; length may vary depending on the hash scheme used */
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_OFST 0
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_LEN 1
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MINNUM 1
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MAXNUM 252
>>> +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MAXNUM_MCDI2 1020
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC
>>> + * Allocate counters for use with blacklist / whitelist rules. (Medford-only;
>>> + * for use by SolarSecure apps, not directly by drivers. See SF-114946-SW.)
>>> + * NOTE - this message definition is provisional. It has not yet been used in
>>> + * any released code and may change during development. This note will be
>>> + * removed once it is regarded as stable.
>>> + */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC 0x112
>>> +#undef MC_CMD_0x112_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x112_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN msgrequest */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_LEN 4
>>> +/* the number of new counter IDs to request */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_NUM_COUNTERS_OFST 0
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_NUM_COUNTERS_LEN 4
>>> +
>>> +/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT msgresponse */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMIN 4
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMAX 252
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMAX_MCDI2 1020
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LEN(num) (4+4*(num))
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_NUM(len) (((len)-4)/4)
>>> +/* the number of new counter IDs allocated (may be less than the number
>>> + * requested if resources are unavailable)
>>> + */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_NUM_COUNTERS_OFST 0
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_NUM_COUNTERS_LEN 4
>>> +/* new counter ID(s) */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_OFST 4
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_LEN 4
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MINNUM 0
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM 62
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM_MCDI2 254
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_SECURITY_RULE_COUNTER_FREE
>>> + * Allocate counters for use with blacklist / whitelist rules. (Medford-only;
>>> + * for use by SolarSecure apps, not directly by drivers. See SF-114946-SW.)
>>> + * NOTE - this message definition is provisional. It has not yet been used in
>>> + * any released code and may change during development. This note will be
>>> + * removed once it is regarded as stable.
>>> + */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE 0x113
>>> +#undef MC_CMD_0x113_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x113_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_SECURITY_RULE_COUNTER_FREE_IN msgrequest */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMIN 4
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMAX 252
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMAX_MCDI2 1020
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LEN(num) (4+4*(num))
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_NUM(len) (((len)-4)/4)
>>> +/* the number of counter IDs to free */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_NUM_COUNTERS_OFST 0
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_NUM_COUNTERS_LEN 4
>>> +/* the counter ID(s) to free */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_OFST 4
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_LEN 4
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MINNUM 0
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MAXNUM 62
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MAXNUM_MCDI2 254
>>> +
>>> +/* MC_CMD_SECURITY_RULE_COUNTER_FREE_OUT msgresponse */
>>> +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_SUBNET_MAP_SET_NODE
>>> + * Atomically update a trie node in the map of subnets to subnet IDs. The
>>> + * constants in the descriptions of the fields of this message may be retrieved
>>> + * by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO. (Medford-
>>> + * only; for use by SolarSecure apps, not directly by drivers. See
>>> + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
>>> + * been used in any released code and may change during development. This note
>>> + * will be removed once it is regarded as stable.
>>> + */
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE 0x114
>>> +#undef MC_CMD_0x114_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x114_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_SUBNET_MAP_SET_NODE_IN msgrequest */
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMIN 6
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMAX 252
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMAX_MCDI2 1020
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LEN(num) (4+2*(num))
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_NUM(len) (((len)-4)/2)
>>> +/* node to update in the range 0 .. SUBNET_MAP_NUM_NODES-1 */
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_NODE_ID_OFST 0
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_NODE_ID_LEN 4
>>> +/* SUBNET_MAP_NUM_ENTRIES_PER_NODE new entries; each entry is either a pointer
>>> + * to the next node, expressed as an offset in the trie memory (i.e. node ID
>>> + * multiplied by SUBNET_MAP_NUM_ENTRIES_PER_NODE), or a leaf value in the range
>>> + * SUBNET_ID_MIN .. SUBNET_ID_MAX
>>> + */
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_OFST 4
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_LEN 2
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MINNUM 1
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MAXNUM 124
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MAXNUM_MCDI2 508
>>> +
>>> +/* MC_CMD_SUBNET_MAP_SET_NODE_OUT msgresponse */
>>> +#define MC_CMD_SUBNET_MAP_SET_NODE_OUT_LEN 0
>>> +
>>> +/* PORTRANGE_TREE_ENTRY structuredef */
>>> +#define PORTRANGE_TREE_ENTRY_LEN 4
>>> +/* key for branch nodes (<= key takes left branch, > key takes right branch),
>>> + * or magic value for leaf nodes
>>> + */
>>> +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_OFST 0
>>> +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_LEN 2
>>> +#define PORTRANGE_TREE_ENTRY_LEAF_NODE_KEY 0xffff /* enum */
>>> +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_LBN 0
>>> +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_WIDTH 16
>>> +/* final portrange ID for leaf nodes (don't care for branch nodes) */
>>> +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_OFST 2
>>> +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_LEN 2
>>> +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_LBN 16
>>> +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_WIDTH 16
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE
>>> + * Atomically update the entire tree mapping remote port ranges to portrange
>>> + * IDs. The constants in the descriptions of the fields of this message may be
>>> + * retrieved by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO.
>>> + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
>>> + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
>>> + * been used in any released code and may change during development. This note
>>> + * will be removed once it is regarded as stable.
>>> + */
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE 0x115
>>> +#undef MC_CMD_0x115_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x115_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN msgrequest */
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMIN 4
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMAX 252
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMAX_MCDI2 1020
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LEN(num) (0+4*(num))
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_NUM(len) (((len)-0)/4)
>>> +/* PORTRANGE_TREE_NUM_ENTRIES new entries, each laid out as a
>>> + * PORTRANGE_TREE_ENTRY
>>> + */
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_OFST 0
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_LEN 4
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MINNUM 1
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM 63
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM_MCDI2 255
>>> +
>>> +/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_OUT msgresponse */
>>> +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE
>>> + * Atomically update the entire tree mapping remote port ranges to portrange
>>> + * IDs. The constants in the descriptions of the fields of this message may be
>>> + * retrieved by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO.
>>> + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
>>> + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
>>> + * been used in any released code and may change during development. This note
>>> + * will be removed once it is regarded as stable.
>>> + */
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE 0x116
>>> +#undef MC_CMD_0x116_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x116_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN msgrequest */
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMIN 4
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMAX 252
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMAX_MCDI2 1020
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LEN(num) (0+4*(num))
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_NUM(len) (((len)-0)/4)
>>> +/* PORTRANGE_TREE_NUM_ENTRIES new entries, each laid out as a
>>> + * PORTRANGE_TREE_ENTRY
>>> + */
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_OFST 0
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_LEN 4
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MINNUM 1
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM 63
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM_MCDI2 255
>>> +
>>> +/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_OUT msgresponse */
>>> +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_OUT_LEN 0
>>> +
>>> /* TUNNEL_ENCAP_UDP_PORT_ENTRY structuredef */
>>> #define TUNNEL_ENCAP_UDP_PORT_ENTRY_LEN 4
>>> /* UDP port (the standard ports are named below but any port may be used) */
>>> @@ -23058,7 +24397,7 @@
>>> #define MC_CMD_RX_BALANCING 0x118
>>> #undef MC_CMD_0x118_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x118_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x118_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_RX_BALANCING_IN msgrequest */
>>> #define MC_CMD_RX_BALANCING_IN_LEN 16
>>> @@ -23079,6 +24418,627 @@
>>> #define MC_CMD_RX_BALANCING_OUT_LEN 0
>>>
>>>
>>> +/***********************************/
>>> +/* MC_CMD_TSA_BIND
>>> + * TSAN - TSAC binding communication protocol. Refer to SF-115479-TC for more
>>> + * info in respect to the binding protocol.
>>> + */
>>> +#define MC_CMD_TSA_BIND 0x119
>>> +#undef MC_CMD_0x119_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x119_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_TSA_BIND_IN msgrequest: Protocol operation code */
>>> +#define MC_CMD_TSA_BIND_IN_LEN 4
>>> +#define MC_CMD_TSA_BIND_IN_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_OP_LEN 4
>>> +/* enum: Obsolete. Use MC_CMD_SECURE_NIC_INFO_IN_STATUS. */
>>> +#define MC_CMD_TSA_BIND_OP_GET_ID 0x1
>>> +/* enum: Get a binding ticket from the TSAN. The binding ticket is used as part
>>> + * of the binding procedure to authorize the binding of an adapter to a TSAID.
>>> + * Refer to SF-114946-SW for more information. This sub-command is only
>>> + * available over a TLS secure connection between the TSAN and TSAC.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OP_GET_TICKET 0x2
>>> +/* enum: Opcode associated with the propagation of a private key that TSAN uses
>>> + * as part of post-binding authentication procedure. More specifically, TSAN
>>> + * uses this key for a signing operation. TSAC uses the counterpart public key
>>> + * to verify the signature. Note - The post-binding authentication occurs when
>>> + * the TSAN-TSAC connection terminates and TSAN tries to reconnect. Refer to
>>> + * SF-114946-SW for more information. This sub-command is only available over a
>>> + * TLS secure connection between the TSAN and TSAC.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OP_SET_KEY 0x3
>>> +/* enum: Request an insecure unbinding operation. This sub-command is available
>>> + * for any privileged client.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OP_UNBIND 0x4
>>> +/* enum: Obsolete. Use MC_CMD_TSA_BIND_OP_SECURE_UNBIND. */
>>> +#define MC_CMD_TSA_BIND_OP_UNBIND_EXT 0x5
>>> +/* enum: Opcode associated with the propagation of the unbinding secret token.
>>> + * TSAN persists the unbinding secret token. Refer to SF-115479-TC for more
>>> + * information. This sub-command is only available over a TLS secure connection
>>> + * between the TSAN and TSAC.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OP_SET_UNBINDTOKEN 0x6
>>> +/* enum: Obsolete. Use MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION. */
>>> +#define MC_CMD_TSA_BIND_OP_DECOMMISSION 0x7
>>> +/* enum: Obsolete. Use MC_CMD_GET_CERTIFICATE. */
>>> +#define MC_CMD_TSA_BIND_OP_GET_CERTIFICATE 0x8
>>> +/* enum: Request a secure unbinding operation using unbinding token. This sub-
>>> + * command is available for any privileged client.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OP_SECURE_UNBIND 0x9
>>> +/* enum: Request a secure decommissioning operation. This sub-command is
>>> + * available for any privileged client.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION 0xa
>>> +/* enum: Test facility that allows an adapter to be configured to behave as if
>>> + * Bound to a TSA controller with restricted MCDI administrator operations.
>>> + * This operation is primarily intended to aid host driver development.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OP_TEST_MCDI 0xb
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_GET_ID msgrequest: Obsolete. Use
>>> + * MC_CMD_SECURE_NIC_INFO_IN_STATUS.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_GET_ID_LEN 20
>>> +/* The operation requested. */
>>> +#define MC_CMD_TSA_BIND_IN_GET_ID_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_GET_ID_OP_LEN 4
>>> +/* Cryptographic nonce that TSAC generates and sends to TSAN. TSAC generates
>>> + * the nonce every time as part of the TSAN post-binding authentication
>>> + * procedure when the TSAN-TSAC connection terminates and TSAN does need to re-
>>> + * connect to the TSAC. Refer to SF-114946-SW for more information.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_GET_ID_NONCE_OFST 4
>>> +#define MC_CMD_TSA_BIND_IN_GET_ID_NONCE_LEN 16
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_GET_TICKET msgrequest */
>>> +#define MC_CMD_TSA_BIND_IN_GET_TICKET_LEN 4
>>> +/* The operation requested. */
>>> +#define MC_CMD_TSA_BIND_IN_GET_TICKET_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_GET_TICKET_OP_LEN 4
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_SET_KEY msgrequest */
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMIN 5
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMAX 252
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMAX_MCDI2 1020
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_LEN(num) (4+1*(num))
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_NUM(len) (((len)-4)/1)
>>> +/* The operation requested. */
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_OP_LEN 4
>>> +/* This data blob contains the private key generated by the TSAC. TSAN uses
>>> + * this key for a signing operation. Note- This private key is used in
>>> + * conjunction with the post-binding TSAN authentication procedure that occurs
>>> + * when the TSAN-TSAC connection terminates and TSAN tries to reconnect. Refer
>>> + * to SF-114946-SW for more information.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_OFST 4
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MINNUM 1
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MAXNUM 248
>>> +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MAXNUM_MCDI2 1016
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_UNBIND msgrequest: Request an insecure unbinding
>>> + * operation.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_LEN 10
>>> +/* The operation requested. */
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_OP_LEN 4
>>> +/* TSAN unique identifier for the network adapter */
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_OFST 4
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_LEN 6
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_UNBIND_EXT msgrequest: Obsolete. Use
>>> + * MC_CMD_TSA_BIND_IN_SECURE_UNBIND.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMIN 93
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMAX 252
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMAX_MCDI2 1020
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LEN(num) (92+1*(num))
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_NUM(len) (((len)-92)/1)
>>> +/* The operation requested. */
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_OP_LEN 4
>>> +/* TSAN unique identifier for the network adapter */
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_OFST 4
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_LEN 6
>>> +/* Align the arguments to 32 bits */
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_RSVD_OFST 10
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_RSVD_LEN 2
>>> +/* This attribute identifies the TSA infrastructure domain. The length of the
>>> + * TSAID attribute is limited to 64 bytes. This is how TSA SDK defines the max
>>> + * length. Note- The TSAID is the Organizational Unit Name filed as part of the
>>> + * root and server certificates.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_OFST 12
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_NUM 64
>>> +/* Unbinding secret token. The adapter validates this unbinding token by
>>> + * comparing it against the one stored on the adapter as part of the
>>> + * MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest. Refer to SF-115479-TC for
>>> + * more information.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_UNBINDTOKEN_OFST 76
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_UNBINDTOKEN_LEN 16
>>> +/* This is the signature of the above mentioned fields- TSANID, TSAID and
>>> + * UNBINDTOKEN. As per current requirements, the SIG opaque data blob contains
>>> + * ECDSA ECC-384 based signature. The ECC curve is secp384r1. The signature is
>>> + * also ASN-1 encoded. Note- The signature is verified based on the public key
>>> + * stored into the root certificate that is provisioned on the adapter side.
>>> + * This key is known as the PUKtsaid. Refer to SF-115479-TC for more
>>> + * information.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_OFST 92
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MINNUM 1
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MAXNUM 160
>>> +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MAXNUM_MCDI2 928
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest */
>>> +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_LEN 20
>>> +/* The operation requested. */
>>> +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_OP_LEN 4
>>> +/* Unbinding secret token. TSAN persists the unbinding secret token. Refer to
>>> + * SF-115479-TC for more information.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_UNBINDTOKEN_OFST 4
>>> +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_UNBINDTOKEN_LEN 16
>>> +/* enum: There are situations when the binding process does not complete
>>> + * successfully due to key, other attributes corruption at the database level
>>> + * (Controller). Adapter can't connect to the controller anymore. To recover,
>>> + * make usage of the decommission command that forces the adapter into
>>> + * unbinding state.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_ADAPTER_BINDING_FAILURE 0x1
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_DECOMMISSION msgrequest: Obsolete. Use
>>> + * MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMIN 109
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMAX 252
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMAX_MCDI2 1020
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LEN(num) (108+1*(num))
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_NUM(len) (((len)-108)/1)
>>> +/* This is the signature of the above mentioned fields- TSAID, USER and REASON.
>>> + * As per current requirements, the SIG opaque data blob contains ECDSA ECC-384
>>> + * based signature. The ECC curve is secp384r1. The signature is also ASN-1
>>> + * encoded . Note- The signature is verified based on the public key stored
>>> + * into the root certificate that is provisioned on the adapter side. This key
>>> + * is known as the PUKtsaid. Refer to SF-115479-TC for more information.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_OFST 108
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MINNUM 1
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MAXNUM 144
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MAXNUM_MCDI2 912
>>> +/* The operation requested. */
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_OP_LEN 4
>>> +/* This attribute identifies the TSA infrastructure domain. The length of the
>>> + * TSAID attribute is limited to 64 bytes. This is how TSA SDK defines the max
>>> + * length. Note- The TSAID is the Organizational Unit Name filed as part of the
>>> + * root and server certificates.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_OFST 4
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_NUM 64
>>> +/* User ID that comes, as an example, from the Controller. Note- The 33 byte
>>> + * length of this attribute is max length of the linux user name plus null
>>> + * character.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_OFST 68
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_NUM 33
>>> +/* Align the arguments to 32 bits */
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_RSVD_OFST 101
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_RSVD_LEN 3
>>> +/* Reason of why decommissioning happens Note- The list of reasons, defined as
>>> + * part of the enumeration below, can be extended.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_REASON_OFST 104
>>> +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_REASON_LEN 4
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_GET_CERTIFICATE msgrequest: Obsolete. Use
>>> + * MC_CMD_GET_CERTIFICATE.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_LEN 8
>>> +/* The operation requested, must be MC_CMD_TSA_BIND_OP_GET_CERTIFICATE. */
>>> +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_OP_LEN 4
>>> +/* Type of the certificate to be retrieved. */
>>> +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_TYPE_OFST 4
>>> +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_TYPE_LEN 4
>>> +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_UNUSED 0x0 /* enum */
>>> +/* enum: Adapter Authentication Certificate (AAC). The AAC is used by the
>>> + * controller to verify the authenticity of the adapter.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_AAC 0x1
>>> +/* enum: Adapter Authentication Signing Certificate (AASC). The AASC is used by
>>> + * the controller to verify the validity of AAC.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_AASC 0x2
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_SECURE_UNBIND msgrequest: Request a secure unbinding
>>> + * operation using unbinding token.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMIN 97
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMAX 200
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMAX_MCDI2 200
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LEN(num) (96+1*(num))
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_NUM(len) (((len)-96)/1)
>>> +/* The operation requested, must be MC_CMD_TSA_BIND_OP_SECURE_UNBIND. */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_OP_LEN 4
>>> +/* Type of the message. (MESSAGE_TYPE_xxx) Must be
>>> + * MESSAGE_TYPE_TSA_SECURE_UNBIND.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_MESSAGE_TYPE_OFST 4
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_MESSAGE_TYPE_LEN 4
>>> +/* TSAN unique identifier for the network adapter */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_OFST 8
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_LEN 6
>>> +/* Align the arguments to 32 bits */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_RSVD_OFST 14
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_RSVD_LEN 2
>>> +/* A NUL padded US-ASCII string identifying the TSA infrastructure domain. This
>>> + * field is for information only, and not used by the firmware. Note- The TSAID
>>> + * is the Organizational Unit Name field as part of the root and server
>>> + * certificates.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_OFST 16
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_NUM 64
>>> +/* Unbinding secret token. The adapter validates this unbinding token by
>>> + * comparing it against the one stored on the adapter as part of the
>>> + * MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest. Refer to SF-115479-TC for
>>> + * more information.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_UNBINDTOKEN_OFST 80
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_UNBINDTOKEN_LEN 16
>>> +/* The signature computed and encoded as specified by MESSAGE_TYPE. */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_OFST 96
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MINNUM 1
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MAXNUM 104
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MAXNUM_MCDI2 104
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION msgrequest: Request a secure
>>> + * decommissioning operation.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMIN 113
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMAX 216
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMAX_MCDI2 216
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LEN(num) (112+1*(num))
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_NUM(len) (((len)-112)/1)
>>> +/* The operation requested, must be MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION. */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_OP_LEN 4
>>> +/* Type of the message. (MESSAGE_TYPE_xxx) Must be
>>> + * MESSAGE_TYPE_SECURE_DECOMMISSION.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_MESSAGE_TYPE_OFST 4
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_MESSAGE_TYPE_LEN 4
>>> +/* A NUL padded US-ASCII string identifying the TSA infrastructure domain. This
>>> + * field is for information only, and not used by the firmware. Note- The TSAID
>>> + * is the Organizational Unit Name field as part of the root and server
>>> + * certificates.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_OFST 8
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_NUM 64
>>> +/* A NUL padded US-ASCII string containing user name of the creator of the
>>> + * decommissioning ticket. This field is for information only, and not used by
>>> + * the firmware.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_OFST 72
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_NUM 36
>>> +/* Reason of why decommissioning happens */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_REASON_OFST 108
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_REASON_LEN 4
>>> +/* enum: There are situations when the binding process does not complete
>>> + * successfully due to key, other attributes corruption at the database level
>>> + * (Controller). Adapter can't connect to the controller anymore. To recover,
>>> + * use the decommission command to force the adapter into unbound state.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_ADAPTER_BINDING_FAILURE 0x1
>>> +/* The signature computed and encoded as specified by MESSAGE_TYPE. */
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_OFST 112
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_LEN 1
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MINNUM 1
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MAXNUM 104
>>> +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MAXNUM_MCDI2 104
>>> +
>>> +/* MC_CMD_TSA_BIND_IN_TEST_MCDI msgrequest: Test mode that emulates MCDI
>>> + * interface restrictions of a bound adapter. This operation is intended for
>>> + * test use on adapters that are not deployed and bound to a TSA Controller.
>>> + * Using it on a Bound adapter will succeed but will not alter the MCDI
>>> + * privileges as MCDI operations will already be restricted.
>>> + */
>>> +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_LEN 8
>>> +/* The operation requested must be MC_CMD_TSA_BIND_OP_TEST_MCDI. */
>>> +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_OP_LEN 4
>>> +/* Enable or disable emulation of bound adapter */
>>> +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_CTRL_OFST 4
>>> +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_CTRL_LEN 4
>>> +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_DISABLE 0x0 /* enum */
>>> +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_ENABLE 0x1 /* enum */
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_GET_ID msgresponse: Obsolete. Use
>>> + * MC_CMD_SECURE_NIC_INFO_OUT_STATUS.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMIN 15
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMAX 252
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMAX_MCDI2 1020
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_LEN(num) (14+1*(num))
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_NUM(len) (((len)-14)/1)
>>> +/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_ID that is sent back to
>>> + * the caller.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_OP_LEN 4
>>> +/* Rules engine type. Note- The rules engine type allows TSAC to further
>>> + * identify the connected endpoint (e.g. TSAN, NIC Emulator) type and take the
>>> + * proper action accordingly. As an example, TSAC uses the rules engine type to
>>> + * select the SF key that differs in the case of TSAN vs. NIC Emulator.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_OFST 4
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_LEN 4
>>> +/* enum: Hardware rules engine. */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_TSAN 0x1
>>> +/* enum: Nic emulator rules engine. */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_NEMU 0x2
>>> +/* enum: SSFE. */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_SSFE 0x3
>>> +/* TSAN unique identifier for the network adapter */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_OFST 8
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_LEN 6
>>> +/* The signature data blob. The signature is computed against the message
>>> + * formed by TSAN ID concatenated with the NONCE value. Refer to SF-115479-TC
>>> + * for more information also in respect to the private keys that are used to
>>> + * sign the message based on TSAN pre/post-binding authentication procedure.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_OFST 14
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_LEN 1
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MINNUM 1
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM 238
>>> +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM_MCDI2 1006
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_GET_TICKET msgresponse */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMIN 5
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMAX 252
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMAX_MCDI2 1020
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LEN(num) (4+1*(num))
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_NUM(len) (((len)-4)/1)
>>> +/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_TICKET that is sent back
>>> + * to the caller.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_OP_LEN 4
>>> +/* The ticket represents the data blob construct that TSAN sends to TSAC as
>>> + * part of the binding protocol. From the TSAN perspective the ticket is an
>>> + * opaque construct. For more info refer to SF-115479-TC.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_OFST 4
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_LEN 1
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MINNUM 1
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MAXNUM 248
>>> +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MAXNUM_MCDI2 1016
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_SET_KEY msgresponse */
>>> +#define MC_CMD_TSA_BIND_OUT_SET_KEY_LEN 4
>>> +/* The protocol operation code MC_CMD_TSA_BIND_OP_SET_KEY that is sent back to
>>> + * the caller.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_SET_KEY_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_SET_KEY_OP_LEN 4
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_UNBIND msgresponse: Response to insecure unbind request.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_LEN 8
>>> +/* Same as MC_CMD_ERR field, but included as 0 in success cases */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_RESULT_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_RESULT_LEN 4
>>> +/* Extra status information */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_INFO_OFST 4
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_INFO_LEN 4
>>> +/* enum: Unbind successful. */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_OK_UNBOUND 0x0
>>> +/* enum: TSANID mismatch */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_BAD_TSANID 0x1
>>> +/* enum: Unable to remove the binding ticket from persistent storage. */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_REMOVE_TICKET 0x2
>>> +/* enum: TSAN is not bound to a binding ticket. */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_NOT_BOUND 0x3
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_UNBIND_EXT msgresponse: Obsolete. Use
>>> + * MC_CMD_TSA_BIND_OUT_SECURE_UNBIND.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_LEN 8
>>> +/* Same as MC_CMD_ERR field, but included as 0 in success cases */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_RESULT_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_RESULT_LEN 4
>>> +/* Extra status information */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_INFO_OFST 4
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_INFO_LEN 4
>>> +/* enum: Unbind successful. */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_OK_UNBOUND 0x0
>>> +/* enum: TSANID mismatch */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_TSANID 0x1
>>> +/* enum: Unable to remove the binding ticket from persistent storage. */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_REMOVE_TICKET 0x2
>>> +/* enum: TSAN is not bound to a binding ticket. */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_NOT_BOUND 0x3
>>> +/* enum: Invalid unbind token */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_TOKEN 0x4
>>> +/* enum: Invalid signature */
>>> +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_SIGNATURE 0x5
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN msgresponse */
>>> +#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_LEN 4
>>> +/* The protocol operation code MC_CMD_TSA_BIND_OP_SET_UNBINDTOKEN that is sent
>>> + * back to the caller.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_OP_LEN 4
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_DECOMMISSION msgresponse: Obsolete. Use
>>> + * MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_LEN 4
>>> +/* The protocol operation code MC_CMD_TSA_BIND_OP_DECOMMISSION that is sent
>>> + * back to the caller.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_OP_LEN 4
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE msgresponse */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMIN 9
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMAX 252
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMAX_MCDI2 1020
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LEN(num) (8+1*(num))
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_NUM(len) (((len)-8)/1)
>>> +/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_CERTIFICATE that is sent
>>> + * back to the caller.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_OP_LEN 4
>>> +/* Type of the certificate. */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_TYPE_OFST 4
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_TYPE_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MC_CMD_TSA_BIND_IN_GET_CERTIFICATE/TYPE */
>>> +/* The certificate data. */
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_OFST 8
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_LEN 1
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MINNUM 1
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MAXNUM 244
>>> +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MAXNUM_MCDI2 1012
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_SECURE_UNBIND msgresponse: Response to secure unbind
>>> + * request.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_LEN 8
>>> +/* The protocol operation code that is sent back to the caller. */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OP_LEN 4
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_RESULT_OFST 4
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_RESULT_LEN 4
>>> +/* enum: Unbind successful. */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OK_UNBOUND 0x0
>>> +/* enum: TSANID mismatch */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_TSANID 0x1
>>> +/* enum: Unable to remove the binding ticket from persistent storage. */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_REMOVE_TICKET 0x2
>>> +/* enum: TSAN is not bound to a domain. */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_NOT_BOUND 0x3
>>> +/* enum: Invalid unbind token */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_TOKEN 0x4
>>> +/* enum: Invalid signature */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_SIGNATURE 0x5
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION msgresponse: Response to secure
>>> + * decommission request.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_LEN 8
>>> +/* The protocol operation code that is sent back to the caller. */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OP_LEN 4
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_RESULT_OFST 4
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_RESULT_LEN 4
>>> +/* enum: Unbind successful. */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OK_UNBOUND 0x0
>>> +/* enum: TSANID mismatch */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_TSANID 0x1
>>> +/* enum: Unable to remove the binding ticket from persistent storage. */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_REMOVE_TICKET 0x2
>>> +/* enum: TSAN is not bound to a domain. */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_NOT_BOUND 0x3
>>> +/* enum: Invalid unbind token */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_TOKEN 0x4
>>> +/* enum: Invalid signature */
>>> +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_SIGNATURE 0x5
>>> +
>>> +/* MC_CMD_TSA_BIND_OUT_TEST_MCDI msgrequest */
>>> +#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_LEN 4
>>> +/* The protocol operation code MC_CMD_TSA_BIND_OP_TEST_MCDI that is sent back
>>> + * to the caller.
>>> + */
>>> +#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_OP_OFST 0
>>> +#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_OP_LEN 4
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE
>>> + * Manage the persistent NVRAM cache of security rules created with
>>> + * MC_CMD_SET_SECURITY_RULE. Note that the cache is not automatically updated
>>> + * as rules are added or removed; the active ruleset must be explicitly
>>> + * committed to the cache. The cache may also be explicitly invalidated,
>>> + * without affecting the currently active ruleset. When the cache is valid, it
>>> + * will be loaded at power on or MC reboot, instead of the default ruleset.
>>> + * Rollback of the currently active ruleset to the cached version (when it is
>>> + * valid) is also supported. (Medford-only; for use by SolarSecure apps, not
>>> + * directly by drivers. See SF-114946-SW.) NOTE - The only sub-operation
>>> + * allowed in an adapter bound to a TSA controller from the local host is
>>> + * OP_GET_CACHED_VERSION. All other sub-operations are prohibited.
>>> + */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE 0x11a
>>> +#undef MC_CMD_0x11a_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x11a_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN msgrequest */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_LEN 4
>>> +/* the operation to perform */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_OFST 0
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_LEN 4
>>> +/* enum: reports the ruleset version that is cached in persistent storage but
>>> + * performs no other action
>>> + */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_GET_CACHED_VERSION 0x0
>>> +/* enum: rolls back the active state to the cached version. (May fail with
>>> + * ENOENT if there is no valid cached version.)
>>> + */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_ROLLBACK 0x1
>>> +/* enum: commits the active state to the persistent cache */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_COMMIT 0x2
>>> +/* enum: invalidates the persistent cache without affecting the active state */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_INVALIDATE 0x3
>>> +
>>> +/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT msgresponse */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMIN 5
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMAX 252
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMAX_MCDI2 1020
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LEN(num) (4+1*(num))
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_NUM(len) (((len)-4)/1)
>>> +/* indicates whether the persistent cache is valid (after completion of the
>>> + * requested operation in the case of rollback, commit, or invalidate)
>>> + */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_OFST 0
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_LEN 4
>>> +/* enum: persistent cache is invalid (the VERSION field will be empty in this
>>> + * case)
>>> + */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_INVALID 0x0
>>> +/* enum: persistent cache is valid */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_VALID 0x1
>>> +/* cached ruleset version (after completion of the requested operation, in the
>>> + * case of rollback, commit, or invalidate) as an opaque hash value in the same
>>> + * form as MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION
>>> + */
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_OFST 4
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_LEN 1
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MINNUM 1
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MAXNUM 248
>>> +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MAXNUM_MCDI2 1016
>>> +
>>> +
>>> /***********************************/
>>> /* MC_CMD_NVRAM_PRIVATE_APPEND
>>> * Append a single TLV to the MC_USAGE_TLV partition. Returns MC_CMD_ERR_EEXIST
>>> @@ -23087,7 +25047,7 @@
>>> #define MC_CMD_NVRAM_PRIVATE_APPEND 0x11c
>>> #undef MC_CMD_0x11c_PRIVILEGE_CTG
>>>
>>> -#define MC_CMD_0x11c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +#define MC_CMD_0x11c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>>
>>> /* MC_CMD_NVRAM_PRIVATE_APPEND_IN msgrequest */
>>> #define MC_CMD_NVRAM_PRIVATE_APPEND_IN_LENMIN 9
>>> @@ -23409,6 +25369,38 @@
>>> #define MC_CMD_DEALLOCATE_TX_VFIFO_CP_OUT_LEN 0
>>>
>>>
>>> +/***********************************/
>>> +/* MC_CMD_REKEY
>>> + * This request causes the NIC to generate a new per-NIC key and program it
>>> + * into the write-once memory. During the process all flash partitions that are
>>> + * protected with a CMAC are verified with the old per-NIC key and then signed
>>> + * with the new per-NIC key. If the NIC has already reached its rekey limit the
>>> + * REKEY op will return MC_CMD_ERR_ERANGE. The REKEY op may block until
>>> + * completion or it may return 0 and continue processing, therefore the caller
>>> + * must poll at least once to confirm that the rekeying has completed. The POLL
>>> + * operation returns MC_CMD_ERR_EBUSY if the rekey process is still running
>>> + * otherwise it will return the result of the last completed rekey operation,
>>> + * or 0 if there has not been a previous rekey.
>>> + */
>>> +#define MC_CMD_REKEY 0x123
>>> +#undef MC_CMD_0x123_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x123_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_REKEY_IN msgrequest */
>>> +#define MC_CMD_REKEY_IN_LEN 4
>>> +/* the type of operation requested */
>>> +#define MC_CMD_REKEY_IN_OP_OFST 0
>>> +#define MC_CMD_REKEY_IN_OP_LEN 4
>>> +/* enum: Start the rekeying operation */
>>> +#define MC_CMD_REKEY_IN_OP_REKEY 0x0
>>> +/* enum: Poll for completion of the rekeying operation */
>>> +#define MC_CMD_REKEY_IN_OP_POLL 0x1
>>> +
>>> +/* MC_CMD_REKEY_OUT msgresponse */
>>> +#define MC_CMD_REKEY_OUT_LEN 0
>>> +
>>> +
>>> /***********************************/
>>> /* MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS
>>> * This interface allows the host to find out how many common pool buffers are
>>> @@ -23432,6 +25424,945 @@
>>> #define MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS_OUT_ENG_LEN 4
>>>
>>>
>>> +/***********************************/
>>> +/* MC_CMD_SET_SECURITY_FUSES
>>> + * Change the security level of the adapter by setting bits in the write-once
>>> + * memory. The firmware maps each flag in the message to a set of one or more
>>> + * hardware-defined or software-defined bits and sets these bits in the write-
>>> + * once memory. For Medford the hardware-defined bits are defined in
>>> + * SF-112079-PS 5.3, the software-defined bits are defined in xpm.h. Returns 0
>>> + * if all of the required bits were set and returns MC_CMD_ERR_EIO if any of
>>> + * the required bits were not set.
>>> + */
>>> +#define MC_CMD_SET_SECURITY_FUSES 0x126
>>> +#undef MC_CMD_0x126_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x126_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_SET_SECURITY_FUSES_IN msgrequest */
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_LEN 4
>>> +/* Flags specifying what type of security features are being set */
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_FLAGS_OFST 0
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_FLAGS_LEN 4
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_OFST 0
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_LBN 0
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_OFST 0
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_LBN 1
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_WIDTH 1
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_OFST 0
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_LBN 31
>>> +#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_WIDTH 1
>>> +
>>> +/* MC_CMD_SET_SECURITY_FUSES_OUT msgresponse */
>>> +#define MC_CMD_SET_SECURITY_FUSES_OUT_LEN 0
>>> +
>>> +/* MC_CMD_SET_SECURITY_FUSES_V2_OUT msgresponse */
>>> +#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_LEN 4
>>> +/* Flags specifying which security features are enforced on the NIC after the
>>> + * flags in the request have been applied. See
>>> + * MC_CMD_SET_SECURITY_FUSES_IN/FLAGS for flag definitions.
>>> + */
>>> +#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_FLAGS_OFST 0
>>> +#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_FLAGS_LEN 4
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_TSA_INFO
>>> + * Messages sent from TSA adapter to TSA controller. This command is only valid
>>> + * when the MCDI header has MESSAGE_TYPE set to MCDI_MESSAGE_TYPE_TSA. This
>>> + * command is not sent by the driver to the MC; it is sent from the MC to a TSA
>>> + * controller, being treated more like an alert message rather than a command;
>>> + * hence the MC does not expect a response in return. Doxbox reference
>>> + * SF-117371-SW
>>> + */
>>> +#define MC_CMD_TSA_INFO 0x127
>>> +#undef MC_CMD_0x127_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x127_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_TSA_INFO_IN msgrequest */
>>> +#define MC_CMD_TSA_INFO_IN_LEN 4
>>> +#define MC_CMD_TSA_INFO_IN_OP_HDR_OFST 0
>>> +#define MC_CMD_TSA_INFO_IN_OP_HDR_LEN 4
>>> +#define MC_CMD_TSA_INFO_IN_OP_OFST 0
>>> +#define MC_CMD_TSA_INFO_IN_OP_LBN 0
>>> +#define MC_CMD_TSA_INFO_IN_OP_WIDTH 16
>>> +/* enum: Information about recently discovered local IP address of the adapter
>>> + */
>>> +#define MC_CMD_TSA_INFO_OP_LOCAL_IP 0x1
>>> +/* enum: Information about a sampled packet that either - did not match any
>>> + * black/white-list filters and was allowed by the default filter or - did not
>>> + * match any black/white-list filters and was denied by the default filter
>>> + */
>>> +#define MC_CMD_TSA_INFO_OP_PKT_SAMPLE 0x2
>>> +/* enum: Information about an unbind or decommission attempt. */
>>> +#define MC_CMD_TSA_INFO_OP_UNBIND 0x3
>>> +
>>> +/* MC_CMD_TSA_INFO_IN_LOCAL_IP msgrequest:
>>> + *
>>> + * The TSA controller maintains a list of IP addresses valid for each port of a
>>> + * TSA adapter. The TSA controller requires information from the adapter
>>> + * inorder to learn new IP addresses assigned to a physical port and to
>>> + * identify those that are no longer assigned to the physical port. For this
>>> + * purpose, the TSA adapter snoops ARP replys, gratuitous ARP requests and ARP
>>> + * probe packets seen on each physical port. This definition describes the
>>> + * format of the notification message sent from a TSA adapter to a TSA
>>> + * controller related to any information related to a change in IP address
>>> + * assignment for a port. Doxbox reference SF-117371.
>>> + *
>>> + * There may be a possibility of combining multiple notifications in a single
>>> + * message in future. When that happens, a new flag can be defined using the
>>> + * reserved bits to describe the extended format of this notification.
>>> + */
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_LEN 18
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_OP_HDR_OFST 0
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_OP_HDR_LEN 4
>>> +/* Additional metadata describing the IP address information such as source of
>>> + * information retrieval, type of IP address, physical port number.
>>> + */
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_LEN 4
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_LBN 0
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_WIDTH 8
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_LBN 8
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_WIDTH 8
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_LBN 16
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_WIDTH 8
>>> +/* enum: ARP reply sent out of the physical port */
>>> +#define MC_CMD_TSA_INFO_IP_REASON_TX_ARP 0x0
>>> +/* enum: ARP probe packet received on the physical port */
>>> +#define MC_CMD_TSA_INFO_IP_REASON_RX_ARP_PROBE 0x1
>>> +/* enum: Gratuitous ARP packet received on the physical port */
>>> +#define MC_CMD_TSA_INFO_IP_REASON_RX_GRATUITOUS_ARP 0x2
>>> +/* enum: DHCP ACK packet received on the physical port */
>>> +#define MC_CMD_TSA_INFO_IP_REASON_RX_DHCP_ACK 0x3
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_LBN 24
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_WIDTH 1
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_LBN 25
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_WIDTH 7
>>> +/* IPV4 address retrieved from the sampled packets. This field is relevant only
>>> + * when META_IPV4 is set to 1.
>>> + */
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_IPV4_ADDR_OFST 8
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_IPV4_ADDR_LEN 4
>>> +/* Target MAC address retrieved from the sampled packet. */
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_OFST 12
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_LEN 1
>>> +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_NUM 6
>>> +
>>> +/* MC_CMD_TSA_INFO_IN_PKT_SAMPLE msgrequest:
>>> + *
>>> + * It is desireable for the TSA controller to learn the traffic pattern of
>>> + * packets seen at the network port being monitored. In order to learn about
>>> + * the traffic pattern, the TSA controller may want to sample packets seen at
>>> + * the network port. Based on the packet samples that the TSA controller
>>> + * receives from the adapter, the controller may choose to configure additional
>>> + * black-list or white-list rules to allow or block packets as required.
>>> + *
>>> + * Although the entire sampled packet as seen on the network port is available
>>> + * to the MC the length of sampled packet sent to controller is restricted by
>>> + * MCDI payload size. Besides, the TSA controller does not require the entire
>>> + * packet to make decisions about filter updates. Hence the packet sample being
>>> + * passed to the controller is truncated to 128 bytes. This length is large
>>> + * enough to hold the ethernet header, IP header and maximum length of
>>> + * supported L4 protocol headers (IPv4 only, but can hold IPv6 header too, if
>>> + * required in future).
>>> + *
>>> + * The intention is that any future changes to this message format that are not
>>> + * backwards compatible will be defined with a new operation code.
>>> + */
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_LEN 136
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_OP_HDR_OFST 0
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_OP_HDR_LEN 4
>>> +/* Additional metadata describing the sampled packet */
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_LEN 4
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_LBN 0
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_WIDTH 8
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_LBN 8
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_WIDTH 1
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_LBN 9
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_WIDTH 7
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_LBN 16
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_WIDTH 4
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_LBN 16
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_WIDTH 1
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_LBN 17
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_WIDTH 1
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_LBN 18
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_WIDTH 1
>>> +/* 128-byte raw prefix of the sampled packet which includes the ethernet
>>> + * header, IP header and L4 protocol header (only IPv4 supported initially).
>>> + * This provides the controller enough information about the packet sample to
>>> + * report traffic patterns seen on a network port and to make decisions
>>> + * concerning rule-set updates.
>>> + */
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_OFST 8
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_LEN 1
>>> +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_NUM 128
>>> +
>>> +/* MC_CMD_TSA_INFO_IN_UNBIND msgrequest: Information about an unbind or
>>> + * decommission attempt. The purpose of this event is to let the controller
>>> + * know about unbind and decommission attempts (both successful and failed)
>>> + * received from the adapter host. The event is not sent if the unbind or
>>> + * decommission request was received from the controller.
>>> + */
>>> +#define MC_CMD_TSA_INFO_IN_UNBIND_LEN 12
>>> +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_HDR_OFST 0
>>> +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_HDR_LEN 4
>>> +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_OFST 0
>>> +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_LBN 0
>>> +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_WIDTH 16
>>> +/* Type of the unbind attempt. */
>>> +#define MC_CMD_TSA_INFO_IN_UNBIND_TYPE_OFST 4
>>> +#define MC_CMD_TSA_INFO_IN_UNBIND_TYPE_LEN 4
>>> +/* enum: This event is sent because MC_CMD_TSA_BIND_OP_SECURE_UNBIND was
>>> + * received from the adapter local host.
>>> + */
>>> +#define MC_CMD_TSA_INFO_UNBIND_TYPE_SECURE_UNBIND 0x1
>>> +/* enum: This event is sent because MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION was
>>> + * received from the adapter local host.
>>> + */
>>> +#define MC_CMD_TSA_INFO_UNBIND_TYPE_SECURE_DECOMMISSION 0x2
>>> +/* Result of the attempt. */
>>> +#define MC_CMD_TSA_INFO_IN_UNBIND_RESULT_OFST 8
>>> +#define MC_CMD_TSA_INFO_IN_UNBIND_RESULT_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MC_CMD_TSA_BIND/MC_CMD_TSA_BIND_OUT_SECURE_UNBIND/RESULT */
>>> +
>>> +/* MC_CMD_TSA_INFO_OUT msgresponse */
>>> +#define MC_CMD_TSA_INFO_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_HOST_INFO
>>> + * Commands to appply or retrieve host-related information from an adapter.
>>> + * Doxbox reference SF-117371-SW
>>> + */
>>> +#define MC_CMD_HOST_INFO 0x128
>>> +#undef MC_CMD_0x128_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x128_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_HOST_INFO_IN msgrequest */
>>> +#define MC_CMD_HOST_INFO_IN_LEN 4
>>> +/* sub-operation code info */
>>> +#define MC_CMD_HOST_INFO_IN_OP_HDR_OFST 0
>>> +#define MC_CMD_HOST_INFO_IN_OP_HDR_LEN 4
>>> +#define MC_CMD_HOST_INFO_IN_OP_OFST 0
>>> +#define MC_CMD_HOST_INFO_IN_OP_LBN 0
>>> +#define MC_CMD_HOST_INFO_IN_OP_WIDTH 16
>>> +/* enum: Read a 16-byte unique host identifier from the adapter. This UUID
>>> + * helps to identify the host that an adapter is plugged into. This identifier
>>> + * is ideally the system UUID retrieved and set by the UEFI driver. If the UEFI
>>> + * driver is unable to extract the system UUID, it would still set a random
>>> + * 16-byte value into each supported SF adapter plugged into it. Host UUIDs may
>>> + * change if the system is power-cycled, however, they persist across adapter
>>> + * resets. If the host UUID was not set on an adapter, due to an unsupported
>>> + * version of UEFI driver, then this command returns an error. Doxbox reference
>>> + * - SF-117371-SW section 'Host UUID'.
>>> + */
>>> +#define MC_CMD_HOST_INFO_OP_GET_UUID 0x0
>>> +/* enum: Set a 16-byte unique host identifier on the adapter to identify the
>>> + * host that the adapter is plugged into. See MC_CMD_HOST_INFO_OP_GET_UUID for
>>> + * further details.
>>> + */
>>> +#define MC_CMD_HOST_INFO_OP_SET_UUID 0x1
>>> +
>>> +/* MC_CMD_HOST_INFO_IN_GET_UUID msgrequest */
>>> +#define MC_CMD_HOST_INFO_IN_GET_UUID_LEN 4
>>> +/* sub-operation code info */
>>> +#define MC_CMD_HOST_INFO_IN_GET_UUID_OP_HDR_OFST 0
>>> +#define MC_CMD_HOST_INFO_IN_GET_UUID_OP_HDR_LEN 4
>>> +
>>> +/* MC_CMD_HOST_INFO_OUT_GET_UUID msgresponse */
>>> +#define MC_CMD_HOST_INFO_OUT_GET_UUID_LEN 16
>>> +/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
>>> + * for further details.
>>> + */
>>> +#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_OFST 0
>>> +#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_LEN 1
>>> +#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_NUM 16
>>> +
>>> +/* MC_CMD_HOST_INFO_IN_SET_UUID msgrequest */
>>> +#define MC_CMD_HOST_INFO_IN_SET_UUID_LEN 20
>>> +/* sub-operation code info */
>>> +#define MC_CMD_HOST_INFO_IN_SET_UUID_OP_HDR_OFST 0
>>> +#define MC_CMD_HOST_INFO_IN_SET_UUID_OP_HDR_LEN 4
>>> +/* 16-byte host UUID set on the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID for
>>> + * further details.
>>> + */
>>> +#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_OFST 4
>>> +#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_LEN 1
>>> +#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_NUM 16
>>> +
>>> +/* MC_CMD_HOST_INFO_OUT_SET_UUID msgresponse */
>>> +#define MC_CMD_HOST_INFO_OUT_SET_UUID_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_TSAN_INFO
>>> + * Get TSA adapter information. TSA controllers query each TSA adapter to learn
>>> + * some configuration parameters of each adapter. Doxbox reference SF-117371-SW
>>> + * section 'Adapter Information'
>>> + */
>>> +#define MC_CMD_TSAN_INFO 0x129
>>> +#undef MC_CMD_0x129_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x129_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_TSAN_INFO_IN msgrequest */
>>> +#define MC_CMD_TSAN_INFO_IN_LEN 4
>>> +/* sub-operation code info */
>>> +#define MC_CMD_TSAN_INFO_IN_OP_HDR_OFST 0
>>> +#define MC_CMD_TSAN_INFO_IN_OP_HDR_LEN 4
>>> +#define MC_CMD_TSAN_INFO_IN_OP_OFST 0
>>> +#define MC_CMD_TSAN_INFO_IN_OP_LBN 0
>>> +#define MC_CMD_TSAN_INFO_IN_OP_WIDTH 16
>>> +/* enum: Read configuration parameters and IDs that uniquely identify an
>>> + * adapter. The parameters include - host identification, adapter
>>> + * identification string and number of physical ports on the adapter.
>>> + */
>>> +#define MC_CMD_TSAN_INFO_OP_GET_CFG 0x0
>>> +
>>> +/* MC_CMD_TSAN_INFO_IN_GET_CFG msgrequest */
>>> +#define MC_CMD_TSAN_INFO_IN_GET_CFG_LEN 4
>>> +/* sub-operation code info */
>>> +#define MC_CMD_TSAN_INFO_IN_GET_CFG_OP_HDR_OFST 0
>>> +#define MC_CMD_TSAN_INFO_IN_GET_CFG_OP_HDR_LEN 4
>>> +
>>> +/* MC_CMD_TSAN_INFO_OUT_GET_CFG msgresponse */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_LEN 26
>>> +/* Information about the configuration parameters returned in this response. */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CONFIG_WORD_OFST 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CONFIG_WORD_LEN 4
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_OFST 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_LBN 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_WIDTH 16
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_OFST 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_LBN 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_WIDTH 1
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_OFST 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_LBN 16
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_WIDTH 8
>>> +/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
>>> + * for further details.
>>> + */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_OFST 4
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_LEN 1
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_NUM 16
>>> +/* A unique identifier per adapter. The base MAC address of the card is used
>>> + * for this purpose.
>>> + */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_OFST 20
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_LEN 1
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_NUM 6
>>> +
>>> +/* MC_CMD_TSAN_INFO_OUT_GET_CFG_V2 msgresponse */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_LEN 36
>>> +/* Information about the configuration parameters returned in this response. */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CONFIG_WORD_OFST 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CONFIG_WORD_LEN 4
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_OFST 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_LBN 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_WIDTH 16
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_OFST 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_LBN 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_WIDTH 1
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_OFST 0
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_LBN 16
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_WIDTH 8
>>> +/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
>>> + * for further details.
>>> + */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_OFST 4
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_LEN 1
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_NUM 16
>>> +/* A unique identifier per adapter. The base MAC address of the card is used
>>> + * for this purpose.
>>> + */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_OFST 20
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_LEN 1
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_NUM 6
>>> +/* Unused bytes, defined for 32-bit alignment of new fields. */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_UNUSED_OFST 26
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_UNUSED_LEN 2
>>> +/* Maximum number of TSA statistics counters in each direction of dataflow
>>> + * supported on the card. Note that the statistics counters are always
>>> + * allocated in pairs, i.e. a counter ID is associated with one Tx and one Rx
>>> + * counter.
>>> + */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_MAX_STATS_OFST 28
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_MAX_STATS_LEN 4
>>> +/* Width of each statistics counter (represented in bits). This gives an
>>> + * indication of wrap point to the user.
>>> + */
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_STATS_WIDTH_OFST 32
>>> +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_STATS_WIDTH_LEN 4
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_TSA_STATISTICS
>>> + * TSA adapter statistics operations.
>>> + */
>>> +#define MC_CMD_TSA_STATISTICS 0x130
>>> +#undef MC_CMD_0x130_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x130_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_TSA_STATISTICS_IN msgrequest */
>>> +#define MC_CMD_TSA_STATISTICS_IN_LEN 4
>>> +/* TSA statistics sub-operation code */
>>> +#define MC_CMD_TSA_STATISTICS_IN_OP_CODE_OFST 0
>>> +#define MC_CMD_TSA_STATISTICS_IN_OP_CODE_LEN 4
>>> +/* enum: Get the configuration parameters that describe the TSA statistics
>>> + * layout on the adapter.
>>> + */
>>> +#define MC_CMD_TSA_STATISTICS_OP_GET_CONFIG 0x0
>>> +/* enum: Read and/or clear TSA statistics counters. */
>>> +#define MC_CMD_TSA_STATISTICS_OP_READ_CLEAR 0x1
>>> +
>>> +/* MC_CMD_TSA_STATISTICS_IN_GET_CONFIG msgrequest */
>>> +#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_LEN 4
>>> +/* TSA statistics sub-operation code */
>>> +#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_OP_CODE_OFST 0
>>> +#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_OP_CODE_LEN 4
>>> +
>>> +/* MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG msgresponse */
>>> +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_LEN 8
>>> +/* Maximum number of TSA statistics counters in each direction of dataflow
>>> + * supported on the card. Note that the statistics counters are always
>>> + * allocated in pairs, i.e. a counter ID is associated with one Tx and one Rx
>>> + * counter.
>>> + */
>>> +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_MAX_STATS_OFST 0
>>> +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_MAX_STATS_LEN 4
>>> +/* Width of each statistics counter (represented in bits). This gives an
>>> + * indication of wrap point to the user.
>>> + */
>>> +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_STATS_WIDTH_OFST 4
>>> +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_STATS_WIDTH_LEN 4
>>> +
>>> +/* MC_CMD_TSA_STATISTICS_IN_READ_CLEAR msgrequest */
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMIN 20
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMAX 252
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMAX_MCDI2 1020
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LEN(num) (16+4*(num))
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_NUM(len) (((len)-16)/4)
>>> +/* TSA statistics sub-operation code */
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_OP_CODE_OFST 0
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_OP_CODE_LEN 4
>>> +/* Parameters describing the statistics operation */
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_FLAGS_OFST 4
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_FLAGS_LEN 4
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_OFST 4
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_LBN 0
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_WIDTH 1
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_OFST 4
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_LBN 1
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_WIDTH 1
>>> +/* Counter ID list specification type */
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_MODE_OFST 8
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_MODE_LEN 4
>>> +/* enum: The statistics counters are specified as an unordered list of
>>> + * individual counter ID.
>>> + */
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LIST 0x0
>>> +/* enum: The statistics counters are specified as a range of consecutive
>>> + * counter IDs.
>>> + */
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_RANGE 0x1
>>> +/* Number of statistics counters */
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_NUM_STATS_OFST 12
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_NUM_STATS_LEN 4
>>> +/* Counter IDs to be read/cleared. When mode is set to LIST, this entry holds a
>>> + * list of counter IDs to be operated on. When mode is set to RANGE, this entry
>>> + * holds a single counter ID representing the start of the range of counter IDs
>>> + * to be operated on.
>>> + */
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_OFST 16
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_LEN 4
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MINNUM 1
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MAXNUM 59
>>> +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MAXNUM_MCDI2 251
>>> +
>>> +/* MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR msgresponse */
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMIN 24
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMAX 248
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMAX_MCDI2 1016
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LEN(num) (8+16*(num))
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_NUM(len) (((len)-8)/16)
>>> +/* Number of statistics counters returned in this response */
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_NUM_STATS_OFST 0
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_NUM_STATS_LEN 4
>>> +/* MC_TSA_STATISTICS_ENTRY Note that this field is expected to start at a
>>> + * 64-bit aligned offset
>>> + */
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_OFST 8
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_LEN 16
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MINNUM 1
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MAXNUM 15
>>> +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MAXNUM_MCDI2 63
>>> +
>>> +/* MC_TSA_STATISTICS_ENTRY structuredef */
>>> +#define MC_TSA_STATISTICS_ENTRY_LEN 16
>>> +/* Tx statistics counter */
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_OFST 0
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LEN 8
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_OFST 0
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_LEN 4
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_LBN 0
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_WIDTH 32
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_OFST 4
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_LEN 4
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_LBN 32
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_WIDTH 32
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LBN 0
>>> +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_WIDTH 64
>>> +/* Rx statistics counter */
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_OFST 8
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LEN 8
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_OFST 8
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_LEN 4
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_LBN 64
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_WIDTH 32
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_OFST 12
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_LEN 4
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_LBN 96
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_WIDTH 32
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LBN 64
>>> +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_WIDTH 64
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_ERASE_INITIAL_NIC_SECRET
>>> + * This request causes the NIC to find the initial NIC secret (programmed
>>> + * during ATE) in XPM memory and if and only if the NIC has already been
>>> + * rekeyed with MC_CMD_REKEY, erase it. This is used by manftest after
>>> + * installing TSA binding certificates. See SF-117631-TC.
>>> + */
>>> +#define MC_CMD_ERASE_INITIAL_NIC_SECRET 0x131
>>> +#undef MC_CMD_0x131_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x131_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_ERASE_INITIAL_NIC_SECRET_IN msgrequest */
>>> +#define MC_CMD_ERASE_INITIAL_NIC_SECRET_IN_LEN 0
>>> +
>>> +/* MC_CMD_ERASE_INITIAL_NIC_SECRET_OUT msgresponse */
>>> +#define MC_CMD_ERASE_INITIAL_NIC_SECRET_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_TSA_CONFIG
>>> + * TSA adapter configuration operations. This command is used to prepare the
>>> + * NIC for TSA binding.
>>> + */
>>> +#define MC_CMD_TSA_CONFIG 0x64
>>> +#undef MC_CMD_0x64_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x64_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_TSA_CONFIG_IN msgrequest */
>>> +#define MC_CMD_TSA_CONFIG_IN_LEN 4
>>> +/* TSA configuration sub-operation code */
>>> +#define MC_CMD_TSA_CONFIG_IN_OP_OFST 0
>>> +#define MC_CMD_TSA_CONFIG_IN_OP_LEN 4
>>> +/* enum: Append a single item to the tsa_config partition. Items will be
>>> + * encrypted unless they are declared as non-sensitive. Returns
>>> + * MC_CMD_ERR_EEXIST if the tag is already present.
>>> + */
>>> +#define MC_CMD_TSA_CONFIG_OP_APPEND 0x1
>>> +/* enum: Reset the tsa_config partition to a clean state. */
>>> +#define MC_CMD_TSA_CONFIG_OP_RESET 0x2
>>> +/* enum: Read back a configured item from tsa_config partition. Returns
>>> + * MC_CMD_ERR_ENOENT if the item doesn't exist, or MC_CMD_ERR_EPERM if the item
>>> + * is declared as sensitive (i.e. is encrypted).
>>> + */
>>> +#define MC_CMD_TSA_CONFIG_OP_READ 0x3
>>> +
>>> +/* MC_CMD_TSA_CONFIG_IN_APPEND msgrequest */
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMIN 12
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMAX 252
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMAX_MCDI2 1020
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_LEN(num) (12+1*(num))
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_NUM(len) (((len)-12)/1)
>>> +/* TSA configuration sub-operation code. The value shall be
>>> + * MC_CMD_TSA_CONFIG_OP_APPEND.
>>> + */
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_OP_OFST 0
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_OP_LEN 4
>>> +/* The tag to be appended */
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_TAG_OFST 4
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_TAG_LEN 4
>>> +/* The length of the data in bytes */
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENGTH_OFST 8
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENGTH_LEN 4
>>> +/* The item data */
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_OFST 12
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_LEN 1
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MINNUM 0
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MAXNUM 240
>>> +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MAXNUM_MCDI2 1008
>>> +
>>> +/* MC_CMD_TSA_CONFIG_OUT_APPEND msgresponse */
>>> +#define MC_CMD_TSA_CONFIG_OUT_APPEND_LEN 0
>>> +
>>> +/* MC_CMD_TSA_CONFIG_IN_RESET msgrequest */
>>> +#define MC_CMD_TSA_CONFIG_IN_RESET_LEN 4
>>> +/* TSA configuration sub-operation code. The value shall be
>>> + * MC_CMD_TSA_CONFIG_OP_RESET.
>>> + */
>>> +#define MC_CMD_TSA_CONFIG_IN_RESET_OP_OFST 0
>>> +#define MC_CMD_TSA_CONFIG_IN_RESET_OP_LEN 4
>>> +
>>> +/* MC_CMD_TSA_CONFIG_OUT_RESET msgresponse */
>>> +#define MC_CMD_TSA_CONFIG_OUT_RESET_LEN 0
>>> +
>>> +/* MC_CMD_TSA_CONFIG_IN_READ msgrequest */
>>> +#define MC_CMD_TSA_CONFIG_IN_READ_LEN 8
>>> +/* TSA configuration sub-operation code. The value shall be
>>> + * MC_CMD_TSA_CONFIG_OP_READ.
>>> + */
>>> +#define MC_CMD_TSA_CONFIG_IN_READ_OP_OFST 0
>>> +#define MC_CMD_TSA_CONFIG_IN_READ_OP_LEN 4
>>> +/* The tag to be read */
>>> +#define MC_CMD_TSA_CONFIG_IN_READ_TAG_OFST 4
>>> +#define MC_CMD_TSA_CONFIG_IN_READ_TAG_LEN 4
>>> +
>>> +/* MC_CMD_TSA_CONFIG_OUT_READ msgresponse */
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_LENMIN 8
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_LENMAX 252
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_LENMAX_MCDI2 1020
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_LEN(num) (8+1*(num))
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_NUM(len) (((len)-8)/1)
>>> +/* The tag that was read */
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_TAG_OFST 0
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_TAG_LEN 4
>>> +/* The length of the data in bytes */
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_LENGTH_OFST 4
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_LENGTH_LEN 4
>>> +/* The data of the item. */
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_OFST 8
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_LEN 1
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MINNUM 0
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MAXNUM 244
>>> +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MAXNUM_MCDI2 1012
>>> +
>>> +/* MC_TSA_IPV4_ITEM structuredef */
>>> +#define MC_TSA_IPV4_ITEM_LEN 8
>>> +/* Additional metadata describing the IP address information such as the
>>> + * physical port number the address is being used on. Unused space in this
>>> + * field is reserved for future expansion.
>>> + */
>>> +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_OFST 0
>>> +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_LEN 4
>>> +#define MC_TSA_IPV4_ITEM_PORT_IDX_OFST 0
>>> +#define MC_TSA_IPV4_ITEM_PORT_IDX_LBN 0
>>> +#define MC_TSA_IPV4_ITEM_PORT_IDX_WIDTH 8
>>> +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_LBN 0
>>> +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_WIDTH 32
>>> +/* The IPv4 address in little endian byte order. */
>>> +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_OFST 4
>>> +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_LEN 4
>>> +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_LBN 32
>>> +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_WIDTH 32
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_TSA_IPADDR
>>> + * TSA operations relating to the monitoring and expiry of local IP addresses
>>> + * discovered by the controller. These commands are sent from a TSA controller
>>> + * to a TSA adapter.
>>> + */
>>> +#define MC_CMD_TSA_IPADDR 0x65
>>> +#undef MC_CMD_0x65_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x65_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_TSA_IPADDR_IN msgrequest */
>>> +#define MC_CMD_TSA_IPADDR_IN_LEN 4
>>> +/* Header containing information to identify which sub-operation of this
>>> + * command to perform. The header contains a 16-bit op-code. Unused space in
>>> + * this field is reserved for future expansion.
>>> + */
>>> +#define MC_CMD_TSA_IPADDR_IN_OP_HDR_OFST 0
>>> +#define MC_CMD_TSA_IPADDR_IN_OP_HDR_LEN 4
>>> +#define MC_CMD_TSA_IPADDR_IN_OP_OFST 0
>>> +#define MC_CMD_TSA_IPADDR_IN_OP_LBN 0
>>> +#define MC_CMD_TSA_IPADDR_IN_OP_WIDTH 16
>>> +/* enum: Request that the adapter verifies that the IPv4 addresses supplied are
>>> + * still in use by the host by sending ARP probes to the host. The MC does not
>>> + * wait for a response to the probes and sends an MCDI response to the
>>> + * controller once the probes have been sent to the host. The response to the
>>> + * probes (if there are any) will be forwarded to the controller using
>>> + * MC_CMD_TSA_INFO alerts.
>>> + */
>>> +#define MC_CMD_TSA_IPADDR_OP_VALIDATE_IPV4 0x1
>>> +/* enum: Notify the adapter that one or more IPv4 addresses are no longer valid
>>> + * for the host of the adapter. The adapter should remove the IPv4 addresses
>>> + * from its local cache.
>>> + */
>>> +#define MC_CMD_TSA_IPADDR_OP_REMOVE_IPV4 0x2
>>> +
>>> +/* MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4 msgrequest */
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMIN 16
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMAX 248
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMAX_MCDI2 1016
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LEN(num) (8+8*(num))
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_NUM(len) (((len)-8)/8)
>>> +/* Header containing information to identify which sub-operation of this
>>> + * command to perform. The header contains a 16-bit op-code. Unused space in
>>> + * this field is reserved for future expansion.
>>> + */
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_HDR_OFST 0
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_HDR_LEN 4
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_OFST 0
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_LBN 0
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_WIDTH 16
>>> +/* Number of IPv4 addresses to validate. */
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_NUM_ITEMS_OFST 4
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_NUM_ITEMS_LEN 4
>>> +/* The IPv4 addresses to validate, in struct MC_TSA_IPV4_ITEM format. */
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_OFST 8
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LEN 8
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_OFST 8
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_LEN 4
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_LBN 64
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_WIDTH 32
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_OFST 12
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_LEN 4
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_LBN 96
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_WIDTH 32
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MINNUM 1
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MAXNUM 30
>>> +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MAXNUM_MCDI2 126
>>> +
>>> +/* MC_CMD_TSA_IPADDR_OUT_VALIDATE_IPV4 msgresponse */
>>> +#define MC_CMD_TSA_IPADDR_OUT_VALIDATE_IPV4_LEN 0
>>> +
>>> +/* MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4 msgrequest */
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMIN 16
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMAX 248
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMAX_MCDI2 1016
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LEN(num) (8+8*(num))
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_NUM(len) (((len)-8)/8)
>>> +/* Header containing information to identify which sub-operation of this
>>> + * command to perform. The header contains a 16-bit op-code. Unused space in
>>> + * this field is reserved for future expansion.
>>> + */
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_HDR_OFST 0
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_HDR_LEN 4
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_OFST 0
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_LBN 0
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_WIDTH 16
>>> +/* Number of IPv4 addresses to remove. */
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_NUM_ITEMS_OFST 4
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_NUM_ITEMS_LEN 4
>>> +/* The IPv4 addresses that have expired, in struct MC_TSA_IPV4_ITEM format. */
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_OFST 8
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LEN 8
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_OFST 8
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_LEN 4
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_LBN 64
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_WIDTH 32
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_OFST 12
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_LEN 4
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_LBN 96
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_WIDTH 32
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MINNUM 1
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MAXNUM 30
>>> +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MAXNUM_MCDI2 126
>>> +
>>> +/* MC_CMD_TSA_IPADDR_OUT_REMOVE_IPV4 msgresponse */
>>> +#define MC_CMD_TSA_IPADDR_OUT_REMOVE_IPV4_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_SECURE_NIC_INFO
>>> + * Get secure NIC information. While many of the features reported by these
>>> + * commands are related to TSA, they must be supported in firmware where TSA is
>>> + * disabled.
>>> + */
>>> +#define MC_CMD_SECURE_NIC_INFO 0x132
>>> +#undef MC_CMD_0x132_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x132_PRIVILEGE_CTG SRIOV_CTG_GENERAL
>>> +
>>> +/* MC_CMD_SECURE_NIC_INFO_IN msgrequest */
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_LEN 4
>>> +/* sub-operation code info */
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_OP_HDR_OFST 0
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_OP_HDR_LEN 4
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_OP_OFST 0
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_OP_LBN 0
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_OP_WIDTH 16
>>> +/* enum: Get the status of various security settings, all signed along with a
>>> + * challenge chosen by the host.
>>> + */
>>> +#define MC_CMD_SECURE_NIC_INFO_OP_STATUS 0x0
>>> +
>>> +/* MC_CMD_SECURE_NIC_INFO_IN_STATUS msgrequest */
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_LEN 24
>>> +/* sub-operation code, must be MC_CMD_SECURE_NIC_INFO_OP_STATUS */
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_OP_HDR_OFST 0
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_OP_HDR_LEN 4
>>> +/* Type of key to be used to sign response. */
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_KEY_TYPE_OFST 4
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_KEY_TYPE_LEN 4
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_UNUSED 0x0 /* enum */
>>> +/* enum: Solarflare adapter authentication key, installed by Manftest. */
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_SF_ADAPTER_AUTH 0x1
>>> +/* enum: TSA binding key, installed after adapter is bound to a TSA controller.
>>> + * This is not supported in firmware which does not support TSA.
>>> + */
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_TSA_BINDING 0x2
>>> +/* enum: Customer adapter authentication key. Installed by the customer in the
>>> + * field, but otherwise similar to the Solarflare adapter authentication key.
>>> + */
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CUSTOMER_ADAPTER_AUTH 0x3
>>> +/* Random challenge generated by the host. */
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CHALLENGE_OFST 8
>>> +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CHALLENGE_LEN 16
>>> +
>>> +/* MC_CMD_SECURE_NIC_INFO_OUT_STATUS msgresponse */
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_LEN 420
>>> +/* Length of the signature in MSG_SIGNATURE. */
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN_OFST 0
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN_LEN 4
>>> +/* Signature over the message, starting at MESSAGE_TYPE and continuing to the
>>> + * end of the MCDI response, allowing the message format to be extended. The
>>> + * signature uses ECDSA 384 encoding in ASN.1 format. It has variable length,
>>> + * with a maximum of 384 bytes.
>>> + */
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_OFST 4
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN 384
>>> +/* Enum value indicating the type of response. This protects against chosen
>>> + * message attacks. The enum values are random rather than sequential to make
>>> + * it unlikely that values will be reused should other commands in a different
>>> + * namespace need to create signed messages.
>>> + */
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MESSAGE_TYPE_OFST 388
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MESSAGE_TYPE_LEN 4
>>> +/* enum: Message type value for the response to a
>>> + * MC_CMD_SECURE_NIC_INFO_IN_STATUS message.
>>> + */
>>> +#define MC_CMD_SECURE_NIC_INFO_STATUS 0xdb4
>>> +/* The challenge provided by the host in the MC_CMD_SECURE_NIC_INFO_IN_STATUS
>>> + * message
>>> + */
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_CHALLENGE_OFST 392
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_CHALLENGE_LEN 16
>>> +/* The first 32 bits of XPM memory, which include security and flag bits, die
>>> + * ID and chip ID revision. The meaning of these bits is defined in
>>> + * mc/include/mc/xpm.h in the firmwaresrc repository.
>>> + */
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_XPM_STATUS_BITS_OFST 408
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_XPM_STATUS_BITS_LEN 4
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_A_OFST 412
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_A_LEN 2
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_B_OFST 414
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_B_LEN 2
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_C_OFST 416
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_C_LEN 2
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_D_OFST 418
>>> +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_D_LEN 2
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_TSA_TEST
>>> + * A simple ping-pong command just to test the adapter<>controller MCDI
>>> + * communication channel. This command makes not changes to the TSA adapter's
>>> + * internal state. It is used by the controller just to verify that the MCDI
>>> + * communication channel is working fine. This command takes no additonal
>>> + * parameters in request or response.
>>> + */
>>> +#define MC_CMD_TSA_TEST 0x125
>>> +#undef MC_CMD_0x125_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x125_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_TSA_TEST_IN msgrequest */
>>> +#define MC_CMD_TSA_TEST_IN_LEN 0
>>> +
>>> +/* MC_CMD_TSA_TEST_OUT msgresponse */
>>> +#define MC_CMD_TSA_TEST_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_TSA_RULESET_OVERRIDE
>>> + * Override TSA ruleset that is currently active on the adapter. This operation
>>> + * does not modify the ruleset itself. This operation provides a mechanism to
>>> + * apply an allow-all or deny-all operation on all packets, thereby completely
>>> + * ignoring the rule-set configured on the adapter. The main purpose of this
>>> + * operation is to provide a deterministic state to the TSA firewall during
>>> + * rule-set transitions.
>>> + */
>>> +#define MC_CMD_TSA_RULESET_OVERRIDE 0x12a
>>> +#undef MC_CMD_0x12a_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x12a_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_TSA_RULESET_OVERRIDE_IN msgrequest */
>>> +#define MC_CMD_TSA_RULESET_OVERRIDE_IN_LEN 4
>>> +/* The override state to apply. */
>>> +#define MC_CMD_TSA_RULESET_OVERRIDE_IN_STATE_OFST 0
>>> +#define MC_CMD_TSA_RULESET_OVERRIDE_IN_STATE_LEN 4
>>> +/* enum: No override in place - the existing ruleset is in operation. */
>>> +#define MC_CMD_TSA_RULESET_OVERRIDE_NONE 0x0
>>> +/* enum: Block all packets seen on all datapath channel except those packets
>>> + * required for basic configuration of the TSA NIC such as ARPs and TSA-
>>> + * communication traffic. Such exceptional traffic is handled differently
>>> + * compared to TSA rulesets.
>>> + */
>>> +#define MC_CMD_TSA_RULESET_OVERRIDE_BLOCK 0x1
>>> +/* enum: Allow all packets through all datapath channel. The TSA adapter
>>> + * behaves like a normal NIC without any firewalls.
>>> + */
>>> +#define MC_CMD_TSA_RULESET_OVERRIDE_ALLOW 0x2
>>> +
>>> +/* MC_CMD_TSA_RULESET_OVERRIDE_OUT msgresponse */
>>> +#define MC_CMD_TSA_RULESET_OVERRIDE_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_TSAC_REQUEST
>>> + * Generic command to send requests from a TSA controller to a TSA adapter.
>>> + * Specific usage is determined by the TYPE field.
>>> + */
>>> +#define MC_CMD_TSAC_REQUEST 0x12b
>>> +#undef MC_CMD_0x12b_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x12b_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_TSAC_REQUEST_IN msgrequest */
>>> +#define MC_CMD_TSAC_REQUEST_IN_LEN 4
>>> +/* The type of request from the controller. */
>>> +#define MC_CMD_TSAC_REQUEST_IN_TYPE_OFST 0
>>> +#define MC_CMD_TSAC_REQUEST_IN_TYPE_LEN 4
>>> +/* enum: Request the adapter to resend localIP information from it's cache. The
>>> + * command does not return any IP address information; IP addresses are sent as
>>> + * TSA notifications as descibed in MC_CMD_TSA_INFO_IN_LOCAL_IP.
>>> + */
>>> +#define MC_CMD_TSAC_REQUEST_LOCALIP 0x0
>>> +
>>> +/* MC_CMD_TSAC_REQUEST_OUT msgresponse */
>>> +#define MC_CMD_TSAC_REQUEST_OUT_LEN 0
>>> +
>>> +
>>> /***********************************/
>>> /* MC_CMD_SUC_VERSION
>>> * Get the version of the SUC
>>> @@ -23477,6 +26408,580 @@
>>> #define MC_CMD_SUC_BOOT_VERSION_OUT_VERSION_LEN 4
>>>
>>>
>>> +/***********************************/
>>> +/* MC_CMD_SUC_MANFTEST
>>> + * Operations to support manftest on SUC based systems.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST 0x135
>>> +#undef MC_CMD_0x135_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x135_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_IN_LEN 4
>>> +/* The manftest operation to be performed. */
>>> +#define MC_CMD_SUC_MANFTEST_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_IN_OP_LEN 4
>>> +/* enum: Read serial number and use count. */
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ 0x0
>>> +/* enum: Update use count on wearout adapter. */
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE 0x1
>>> +/* enum: Start an ADC calibration. */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START 0x2
>>> +/* enum: Read the status of an ADC calibration. */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS 0x3
>>> +/* enum: Read the results of an ADC calibration. */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT 0x4
>>> +/* enum: Read the PCIe configuration. */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ 0x5
>>> +/* enum: Write the PCIe configuration. */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE 0x6
>>> +/* enum: Write FRU information to SUC. The FRU information is taken from the
>>> + * FRU_INFORMATION partition. Attempts to write to read-only FRUs are rejected.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_FRU_WRITE 0x7
>>> +/* enum: Read UDID Vendor Specific ID from SUC persistent storage. */
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ 0x8
>>> +/* enum: Write UDID Vendor Specific ID to SUC persistent storage for use in
>>> + * SMBus ARP.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE 0x9
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_OUT_LEN 0
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_LEN 4
>>> +/* The manftest operation to be performed. This must be
>>> + * MC_CMD_SUC_MANFTEST_WEAROUT_READ.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_LEN 20
>>> +/* The serial number of the wearout adapter, see SF-112717-PR for format. */
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_SERIAL_NUMBER_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_SERIAL_NUMBER_LEN 16
>>> +/* The use count of the wearout adapter. */
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_USE_COUNT_OFST 16
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_USE_COUNT_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_LEN 4
>>> +/* The manftest operation to be performed. This must be
>>> + * MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_OUT_LEN 0
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_LEN 4
>>> +/* The manftest operation to be performed. This must be
>>> + * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_OUT_LEN 0
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_LEN 4
>>> +/* The manftest operation to be performed. This must be
>>> + * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_LEN 4
>>> +/* The combined status of the calibration operation. */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FLAGS_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FLAGS_LEN 4
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_LBN 0
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_WIDTH 1
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_LBN 1
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_WIDTH 1
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_LBN 2
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_WIDTH 4
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_LBN 6
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_WIDTH 2
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_LEN 4
>>> +/* The manftest operation to be performed. This must be
>>> + * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_LEN 12
>>> +/* The set of calibration results. */
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_LEN 4
>>> +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_NUM 3
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_LEN 4
>>> +/* The manftest operation to be performed. This must be
>>> + * MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_LEN 4
>>> +/* The PCIe vendor ID. */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_VENDOR_ID_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_VENDOR_ID_LEN 2
>>> +/* The PCIe device ID. */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_DEVICE_ID_OFST 2
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_DEVICE_ID_LEN 2
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_LEN 8
>>> +/* The manftest operation to be performed. This must be
>>> + * MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_OP_LEN 4
>>> +/* The PCIe vendor ID. */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_VENDOR_ID_OFST 4
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_VENDOR_ID_LEN 2
>>> +/* The PCIe device ID. */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_DEVICE_ID_OFST 6
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_DEVICE_ID_LEN 2
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_OUT_LEN 0
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_FRU_WRITE_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_LEN 4
>>> +/* The manftest operation to be performed. This must be
>>> + * MC_CMD_SUC_MANFTEST_FRU_WRITE
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_FRU_WRITE_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_OUT_LEN 0
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_LEN 4
>>> +/* The manftest operation to be performed. This must be
>>> + * MC_CMD_SUC_MANFTEST_SMBUS_ID_READ.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_LEN 4
>>> +/* The SMBus ID. */
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_SMBUS_ID_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_SMBUS_ID_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN msgrequest */
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_LEN 8
>>> +/* The manftest operation to be performed. This must be
>>> + * MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE.
>>> + */
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_OP_OFST 0
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_OP_LEN 4
>>> +/* The SMBus ID. */
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_SMBUS_ID_OFST 4
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_SMBUS_ID_LEN 4
>>> +
>>> +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_OUT msgresponse */
>>> +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_GET_CERTIFICATE
>>> + * Request a certificate.
>>> + */
>>> +#define MC_CMD_GET_CERTIFICATE 0x12c
>>> +#undef MC_CMD_0x12c_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x12c_PRIVILEGE_CTG SRIOV_CTG_GENERAL
>>> +
>>> +/* MC_CMD_GET_CERTIFICATE_IN msgrequest */
>>> +#define MC_CMD_GET_CERTIFICATE_IN_LEN 8
>>> +/* Type of the certificate to be retrieved. */
>>> +#define MC_CMD_GET_CERTIFICATE_IN_TYPE_OFST 0
>>> +#define MC_CMD_GET_CERTIFICATE_IN_TYPE_LEN 4
>>> +#define MC_CMD_GET_CERTIFICATE_IN_UNUSED 0x0 /* enum */
>>> +#define MC_CMD_GET_CERTIFICATE_IN_AAC 0x1 /* enum */
>>> +/* enum: Adapter Authentication Certificate (AAC). The AAC is unique to each
>>> + * adapter and is used to verify its authenticity. It is installed by Manftest.
>>> + */
>>> +#define MC_CMD_GET_CERTIFICATE_IN_ADAPTER_AUTH 0x1
>>> +#define MC_CMD_GET_CERTIFICATE_IN_AASC 0x2 /* enum */
>>> +/* enum: Adapter Authentication Signing Certificate (AASC). The AASC is shared
>>> + * by a group of adapters (typically a purchase order) and is used to verify
>>> + * the validity of AAC along with the SF root certificate. It is installed by
>>> + * Manftest.
>>> + */
>>> +#define MC_CMD_GET_CERTIFICATE_IN_ADAPTER_AUTH_SIGNING 0x2
>>> +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_AAC 0x3 /* enum */
>>> +/* enum: Customer Adapter Authentication Certificate. The Customer AAC is
>>> + * unique to each adapter and is used to verify its authenticity in cases where
>>> + * either the AAC is not installed or a customer desires to use their own
>>> + * certificate chain. It is installed by the customer.
>>> + */
>>> +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_ADAPTER_AUTH 0x3
>>> +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_AASC 0x4 /* enum */
>>> +/* enum: Customer Adapter Authentication Certificate. The Customer AASC is
>>> + * shared by a group of adapters and is used to verify the validity of the
>>> + * Customer AAC along with the customers root certificate. It is installed by
>>> + * the customer.
>>> + */
>>> +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_ADAPTER_AUTH_SIGNING 0x4
>>> +/* Offset, measured in bytes, relative to the start of the certificate data
>>> + * from which the certificate is to be retrieved.
>>> + */
>>> +#define MC_CMD_GET_CERTIFICATE_IN_OFFSET_OFST 4
>>> +#define MC_CMD_GET_CERTIFICATE_IN_OFFSET_LEN 4
>>> +
>>> +/* MC_CMD_GET_CERTIFICATE_OUT msgresponse */
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_LENMIN 13
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_LENMAX 252
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_LENMAX_MCDI2 1020
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_LEN(num) (12+1*(num))
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_NUM(len) (((len)-12)/1)
>>> +/* Type of the certificate. */
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_TYPE_OFST 0
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_TYPE_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MC_CMD_GET_CERTIFICATE_IN/TYPE */
>>> +/* Offset, measured in bytes, relative to the start of the certificate data
>>> + * from which data in this message starts.
>>> + */
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_OFFSET_OFST 4
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_OFFSET_LEN 4
>>> +/* Total length of the certificate data. */
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_TOTAL_LENGTH_OFST 8
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_TOTAL_LENGTH_LEN 4
>>> +/* The certificate data. */
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_OFST 12
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_LEN 1
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MINNUM 1
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MAXNUM 240
>>> +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MAXNUM_MCDI2 1008
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_GET_NIC_GLOBAL
>>> + * Get a global value which applies to all PCI functions
>>> + */
>>> +#define MC_CMD_GET_NIC_GLOBAL 0x12d
>>> +#undef MC_CMD_0x12d_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x12d_PRIVILEGE_CTG SRIOV_CTG_GENERAL
>>> +
>>> +/* MC_CMD_GET_NIC_GLOBAL_IN msgrequest */
>>> +#define MC_CMD_GET_NIC_GLOBAL_IN_LEN 4
>>> +/* Key to request value for, see enum values in MC_CMD_SET_NIC_GLOBAL. If the
>>> + * given key is unknown to the current firmware, the call will fail with
>>> + * ENOENT.
>>> + */
>>> +#define MC_CMD_GET_NIC_GLOBAL_IN_KEY_OFST 0
>>> +#define MC_CMD_GET_NIC_GLOBAL_IN_KEY_LEN 4
>>> +
>>> +/* MC_CMD_GET_NIC_GLOBAL_OUT msgresponse */
>>> +#define MC_CMD_GET_NIC_GLOBAL_OUT_LEN 4
>>> +/* Value of requested key, see key descriptions below. */
>>> +#define MC_CMD_GET_NIC_GLOBAL_OUT_VALUE_OFST 0
>>> +#define MC_CMD_GET_NIC_GLOBAL_OUT_VALUE_LEN 4
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_SET_NIC_GLOBAL
>>> + * Set a global value which applies to all PCI functions. Most global values
>>> + * can only be changed under specific conditions, and this call will return an
>>> + * appropriate error otherwise (see key descriptions).
>>> + */
>>> +#define MC_CMD_SET_NIC_GLOBAL 0x12e
>>> +#undef MC_CMD_0x12e_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x12e_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_SET_NIC_GLOBAL_IN msgrequest */
>>> +#define MC_CMD_SET_NIC_GLOBAL_IN_LEN 8
>>> +/* Key to change value of. Firmware will return ENOENT for keys it doesn't know
>>> + * about.
>>> + */
>>> +#define MC_CMD_SET_NIC_GLOBAL_IN_KEY_OFST 0
>>> +#define MC_CMD_SET_NIC_GLOBAL_IN_KEY_LEN 4
>>> +/* enum: Request switching the datapath firmware sub-variant. Currently only
>>> + * useful when running the DPDK f/w variant. See key values below, and the DPDK
>>> + * section of the EF10 Driver Writers Guide. Note that any driver attaching
>>> + * with the SUBVARIANT_AWARE flag cleared is implicitly considered as a request
>>> + * to switch back to the default sub-variant, and will thus reset this value.
>>> + * If a sub-variant switch happens, all other PCI functions will get their
>>> + * resources reset (they will see an MC reboot).
>>> + */
>>> +#define MC_CMD_SET_NIC_GLOBAL_IN_FIRMWARE_SUBVARIANT 0x1
>>> +/* New value to set, see key descriptions above. */
>>> +#define MC_CMD_SET_NIC_GLOBAL_IN_VALUE_OFST 4
>>> +#define MC_CMD_SET_NIC_GLOBAL_IN_VALUE_LEN 4
>>> +/* enum: Only if KEY = FIRMWARE_SUBVARIANT. Default sub-variant with support
>>> + * for maximum features for the current f/w variant. A request from a
>>> + * privileged function to set this particular value will always succeed.
>>> + */
>>> +#define MC_CMD_SET_NIC_GLOBAL_IN_FW_SUBVARIANT_DEFAULT 0x0
>>> +/* enum: Only if KEY = FIRMWARE_SUBVARIANT. Increases packet rate at the cost
>>> + * of not supporting any TX checksum offloads. Only supported when running some
>>> + * f/w variants, others will return ENOTSUP (as reported by the homonymous bit
>>> + * in MC_CMD_GET_CAPABILITIES_V2). Can only be set when no other drivers are
>>> + * attached, and the calling driver must have no resources allocated. See the
>>> + * DPDK section of the EF10 Driver Writers Guide for a more detailed
>>> + * description with possible error codes.
>>> + */
>>> +#define MC_CMD_SET_NIC_GLOBAL_IN_FW_SUBVARIANT_NO_TX_CSUM 0x1
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_LTSSM_TRACE_POLL
>>> + * Medford2 hardware has support for logging all LTSSM state transitions to a
>>> + * hardware buffer. When built with WITH_LTSSM_TRACE=1, the firmware will
>>> + * periodially dump the contents of this hardware buffer to an internal
>>> + * firmware buffer for later extraction.
>>> + */
>>> +#define MC_CMD_LTSSM_TRACE_POLL 0x12f
>>> +#undef MC_CMD_0x12f_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x12f_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_LTSSM_TRACE_POLL_IN msgrequest: Read transitions from the firmware
>>> + * internal buffer.
>>> + */
>>> +#define MC_CMD_LTSSM_TRACE_POLL_IN_LEN 4
>>> +/* The maximum number of row that the caller can accept. The format of each row
>>> + * is defined in MC_CMD_LTSSM_TRACE_POLL_OUT.
>>> + */
>>> +#define MC_CMD_LTSSM_TRACE_POLL_IN_MAX_ROW_COUNT_OFST 0
>>> +#define MC_CMD_LTSSM_TRACE_POLL_IN_MAX_ROW_COUNT_LEN 4
>>> +
>>> +/* MC_CMD_LTSSM_TRACE_POLL_OUT msgresponse */
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMIN 16
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMAX 248
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMAX_MCDI2 1016
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LEN(num) (8+8*(num))
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_NUM(len) (((len)-8)/8)
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FLAGS_OFST 0
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FLAGS_LEN 4
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_OFST 0
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_LBN 0
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_WIDTH 1
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_OFST 0
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_LBN 1
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_WIDTH 1
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_OFST 0
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_LBN 31
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_WIDTH 1
>>> +/* The number of rows present in this response. */
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROW_COUNT_OFST 4
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROW_COUNT_LEN 4
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_OFST 8
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LEN 8
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_OFST 8
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_LEN 4
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_LBN 64
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_WIDTH 32
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_OFST 12
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_LEN 4
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_LBN 96
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_WIDTH 32
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MINNUM 0
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MAXNUM 30
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MAXNUM_MCDI2 126
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_OFST 8
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_LBN 0
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_WIDTH 6
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_OFST 8
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_LBN 6
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_WIDTH 1
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_OFST 8
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_LBN 7
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_WIDTH 1
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_OFST 8
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_LBN 8
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_WIDTH 24
>>> +/* The time of the LTSSM transition. Times are reported as fractional
>>> + * microseconds since MC boot (wrapping at 2^32us). The fractional part is
>>> + * reported in picoseconds. 0 <= TIMESTAMP_PS < 1000000 timestamp in seconds =
>>> + * ((TIMESTAMP_US + TIMESTAMP_PS / 1000000) / 1000000)
>>> + */
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_US_OFST 12
>>> +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_US_LEN 4
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_TELEMETRY_ENABLE
>>> + * This command enables telemetry processing of packets, allowing a remote host
>>> + * to gather information and analytics passing on the card. Enabling telemetry
>>> + * will have a performance cost. Not supported on all hardware and datapath
>>> + * variants. As of writing, only supported on Medford2 running full-featured
>>> + * firmware variant.
>>> + */
>>> +#define MC_CMD_TELEMETRY_ENABLE 0x138
>>> +#undef MC_CMD_0x138_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x138_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_TELEMETRY_ENABLE_IN msgrequest */
>>> +#define MC_CMD_TELEMETRY_ENABLE_IN_LEN 4
>>> +#define MC_CMD_TELEMETRY_ENABLE_IN_STATE_OFST 0
>>> +#define MC_CMD_TELEMETRY_ENABLE_IN_STATE_LEN 4
>>> +/* enum: Disables telemetry functionality, returns the card to default
>>> + * behaviour of the configured datapath variant.
>>> + */
>>> +#define MC_CMD_TELEMETRY_ENABLE_IN_DISABLE 0x0
>>> +/* enum: Enables telemetry functionality on the currently configured datapath
>>> + * variant if supported.
>>> + */
>>> +#define MC_CMD_TELEMETRY_ENABLE_IN_ENABLE 0x1
>>> +
>>> +/* MC_CMD_TELEMETRY_ENABLE_OUT msgresponse */
>>> +#define MC_CMD_TELEMETRY_ENABLE_OUT_LEN 0
>>> +
>>> +/* TELEMETRY_CONFIG structuredef */
>>> +#define TELEMETRY_CONFIG_LEN 36
>>> +/* Bitfields to identify the list of config parameters included in the command.
>>> + * A bit-value of 1 indicates that the relevant config parameter field is
>>> + * valid; 0 indicates invalid and the config parameter field must be ignored by
>>> + * firmware. Firmware may however apply some default values for certain
>>> + * parameters.
>>> + */
>>> +#define TELEMETRY_CONFIG_FLAGS_OFST 0
>>> +#define TELEMETRY_CONFIG_FLAGS_LEN 4
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_OFST 0
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_LBN 0
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_WIDTH 1
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_OFST 0
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_LBN 1
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_WIDTH 1
>>> +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_OFST 0
>>> +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_LBN 2
>>> +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_WIDTH 1
>>> +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_OFST 0
>>> +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_LBN 3
>>> +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_WIDTH 1
>>> +#define TELEMETRY_CONFIG_RESERVED1_OFST 0
>>> +#define TELEMETRY_CONFIG_RESERVED1_LBN 4
>>> +#define TELEMETRY_CONFIG_RESERVED1_WIDTH 28
>>> +#define TELEMETRY_CONFIG_FLAGS_LBN 0
>>> +#define TELEMETRY_CONFIG_FLAGS_WIDTH 32
>>> +/* Collector IPv4/IPv6 address to which latency measurements are forwarded from
>>> + * the adapter (as bytes in network order; set last 12 bytes to 0 for IPv4
>>> + * address).
>>> + */
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_OFST 4
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_LEN 16
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_LBN 32
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_WIDTH 128
>>> +/* Collector Port number to which latency measurements are forwarded from the
>>> + * adapter (as bytes in network order).
>>> + */
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_OFST 20
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_LEN 2
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_LBN 160
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_WIDTH 16
>>> +/* Unused - set to 0. */
>>> +#define TELEMETRY_CONFIG_RESERVED2_OFST 22
>>> +#define TELEMETRY_CONFIG_RESERVED2_LEN 2
>>> +#define TELEMETRY_CONFIG_RESERVED2_LBN 176
>>> +#define TELEMETRY_CONFIG_RESERVED2_WIDTH 16
>>> +/* MAC address of the collector (as bytes in network order). */
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_OFST 24
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_LEN 6
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_LBN 192
>>> +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_WIDTH 48
>>> +/* Maximum number of latency measurements to be made on a telemetry flow. */
>>> +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_OFST 30
>>> +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_LEN 2
>>> +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_LBN 240
>>> +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_WIDTH 16
>>> +/* Maximum duration for which a telemetry flow is monitored (in millisecs). */
>>> +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_OFST 32
>>> +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_LEN 4
>>> +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_LBN 256
>>> +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_WIDTH 32
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_TELEMETRY_CONFIG
>>> + * This top-level command includes various sub-opcodes that are used to apply
>>> + * (and read-back) telemetry related configuration parameters on the NIC.
>>> + * Reference - SF-120569-SW Telemetry Firmware Design.
>>> + */
>>> +#define MC_CMD_TELEMETRY_CONFIG 0x139
>>> +#undef MC_CMD_0x139_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x139_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_TELEMETRY_CONFIG_IN msgrequest */
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_LEN 4
>>> +/* Telemetry configuration sub-operation code */
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_OP_OFST 0
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_OP_LEN 4
>>> +/* enum: Configure parameters for telemetry measurements. */
>>> +#define MC_CMD_TELEMETRY_CONFIG_OP_SET 0x1
>>> +/* enum: Read current values of parameters for telemetry measurements. */
>>> +#define MC_CMD_TELEMETRY_CONFIG_OP_GET 0x2
>>> +
>>> +/* MC_CMD_TELEMETRY_CONFIG_IN_SET msgrequest: This command configures the
>>> + * parameters necessary for tcp-latency measurements. The adapter adds a filter
>>> + * for every new tcp flow seen in both tx and rx directions and tracks the
>>> + * telemetry measurements related to the flow in a tracking table. Entries in
>>> + * the tracking table live as long as N measurements are made on the flow or
>>> + * the flow has been in the tracking table for the maximum configured duration.
>>> + * Telemetry measurements in this command refer to tcp-latency measurements for
>>> + * data-to-ack latency as well as data-to-data latency. All telemetry
>>> + * measurements are bundled into a UDP packet and forwarded to a collector
>>> + * whose IP address is configured using this command.
>>> + */
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_LEN 40
>>> +/* Telemetry configuration sub-operation code. Must be set to
>>> + * MC_CMD_TELEMETRY_CONFIG_OP_SET.
>>> + */
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_OP_OFST 0
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_OP_LEN 4
>>> +/* struct of type TELEMETRY_CONFIG. */
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_PARAMETERS_OFST 4
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_PARAMETERS_LEN 36
>>> +
>>> +/* MC_CMD_TELEMETRY_CONFIG_OUT_SET msgresponse */
>>> +#define MC_CMD_TELEMETRY_CONFIG_OUT_SET_LEN 0
>>> +
>>> +/* MC_CMD_TELEMETRY_CONFIG_IN_GET msgrequest: This command reads out the
>>> + * current values of config parameters necessary for tcp-latency measurements.
>>> + * See MC_CMD_TELEMETRY_SET_CONFIG for more information about the configuration
>>> + * parameters.
>>> + */
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_GET_LEN 4
>>> +/* Telemetry configuration sub-operation code. Must be set to
>>> + * MC_CMD_TELEMETRY_CONFIG_OP_GET.
>>> + */
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_GET_OP_OFST 0
>>> +#define MC_CMD_TELEMETRY_CONFIG_IN_GET_OP_LEN 4
>>> +
>>> +/* MC_CMD_TELEMETRY_CONFIG_OUT_GET msgresponse */
>>> +#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_LEN 36
>>> +/* struct of type TELEMETRY_CONFIG. */
>>> +#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_PARAMETERS_OFST 0
>>> +#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_PARAMETERS_LEN 36
>>> +
>>> +
>>> /***********************************/
>>> /* MC_CMD_GET_RX_PREFIX_ID
>>> * This command is part of the mechanism for configuring the format of the RX
>>> @@ -23832,6 +27337,427 @@
>>> #define MC_CMD_GET_NCSI_INFO_STATISTICS_OUT_AENS_SENT_OFST 24
>>> #define MC_CMD_GET_NCSI_INFO_STATISTICS_OUT_AENS_SENT_LEN 4
>>>
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_FIRMWARE_SET_LOCKDOWN
>>> + * System lockdown, when enabled firmware updates are blocked.
>>> + */
>>> +#define MC_CMD_FIRMWARE_SET_LOCKDOWN 0x16f
>>> +#undef MC_CMD_0x16f_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x16f_PRIVILEGE_CTG SRIOV_CTG_ADMIN
>>> +
>>> +/* MC_CMD_FIRMWARE_SET_LOCKDOWN_IN msgrequest: This MCDI command is to enable
>>> + * only because lockdown can only be disabled by a PMCI command or a cold reset
>>> + * of the system.
>>> + */
>>> +#define MC_CMD_FIRMWARE_SET_LOCKDOWN_IN_LEN 0
>>> +
>>> +/* MC_CMD_FIRMWARE_SET_LOCKDOWN_OUT msgresponse */
>>> +#define MC_CMD_FIRMWARE_SET_LOCKDOWN_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_GET_TEST_FEATURES
>>> + * This command returns device details knowledge of which may be required by
>>> + * test infrastructure. Although safe, it is not intended to be used by
>>> + * production drivers, and the structure returned intentionally has no public
>>> + * documentation.
>>> + */
>>> +#define MC_CMD_GET_TEST_FEATURES 0x1ac
>>> +#undef MC_CMD_0x1ac_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x1ac_PRIVILEGE_CTG SRIOV_CTG_GENERAL
>>> +
>>> +/* MC_CMD_GET_TEST_FEATURES_IN msgrequest: Request test features. */
>>> +#define MC_CMD_GET_TEST_FEATURES_IN_LEN 0
>>> +
>>> +/* MC_CMD_GET_TEST_FEATURE_OUT msgresponse */
>>> +#define MC_CMD_GET_TEST_FEATURE_OUT_LENMIN 4
>>> +#define MC_CMD_GET_TEST_FEATURE_OUT_LENMAX 252
>>> +#define MC_CMD_GET_TEST_FEATURE_OUT_LENMAX_MCDI2 1020
>>> +#define MC_CMD_GET_TEST_FEATURE_OUT_LEN(num) (0+4*(num))
>>> +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_NUM(len) (((len)-0)/4)
>>> +/* Test-specific NIC information. Production drivers must treat this as opaque.
>>> + * The layout is defined in the private TEST_FEATURES_LAYOUT structure.
>>> + */
>>> +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_OFST 0
>>> +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_LEN 4
>>> +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MINNUM 1
>>> +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MAXNUM 63
>>> +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MAXNUM_MCDI2 255
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_FPGA
>>> + * A command to perform various fpga-related operations on platforms that
>>> + * include FPGAs. Note that some platforms may only support a subset of these
>>> + * operations.
>>> + */
>>> +#define MC_CMD_FPGA 0x1bf
>>> +#undef MC_CMD_0x1bf_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x1bf_PRIVILEGE_CTG SRIOV_CTG_GENERAL
>>> +
>>> +/* MC_CMD_FPGA_IN msgrequest */
>>> +#define MC_CMD_FPGA_IN_LEN 4
>>> +/* Sub-command code */
>>> +#define MC_CMD_FPGA_IN_OP_OFST 0
>>> +#define MC_CMD_FPGA_IN_OP_LEN 4
>>> +/* enum: Get the FPGA version string. */
>>> +#define MC_CMD_FPGA_IN_OP_GET_VERSION 0x0
>>> +/* enum: Read bitmask of features supported in the FPGA image. */
>>> +#define MC_CMD_FPGA_IN_OP_GET_CAPABILITIES 0x1
>>> +/* enum: Perform a FPGA reset. */
>>> +#define MC_CMD_FPGA_IN_OP_RESET 0x2
>>> +/* enum: Set active flash device. */
>>> +#define MC_CMD_FPGA_IN_OP_SELECT_FLASH 0x3
>>> +/* enum: Get active flash device. */
>>> +#define MC_CMD_FPGA_IN_OP_GET_ACTIVE_FLASH 0x4
>>> +/* enum: Configure internal link i.e. the FPGA port facing the ASIC. */
>>> +#define MC_CMD_FPGA_IN_OP_SET_INTERNAL_LINK 0x5
>>> +/* enum: Read internal link configuration. */
>>> +#define MC_CMD_FPGA_IN_OP_GET_INTERNAL_LINK 0x6
>>> +/* enum: Get MAC statistics of FPGA external port. */
>>> +#define MC_CMD_FPGA_IN_OP_GET_MAC_STATS 0x7
>>> +/* enum: Set configuration on internal FPGA MAC. */
>>> +#define MC_CMD_FPGA_IN_OP_SET_INTERNAL_MAC 0x8
>>> +
>>> +/* MC_CMD_FPGA_OP_GET_VERSION_IN msgrequest: Get the FPGA version string. A
>>> + * free-format string is returned in response to this command. Any checks on
>>> + * supported FPGA operations are based on the response to
>>> + * MC_CMD_FPGA_OP_GET_CAPABILITIES.
>>> + */
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_IN_LEN 4
>>> +/* Sub-command code. Must be OP_GET_VERSION */
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_IN_OP_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_FPGA_OP_GET_VERSION_OUT msgresponse: Returns the version string. */
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMIN 0
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMAX 252
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMAX_MCDI2 1020
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LEN(num) (0+1*(num))
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_NUM(len) (((len)-0)/1)
>>> +/* Null-terminated string containing version information. */
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_LEN 1
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MINNUM 0
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MAXNUM 252
>>> +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MAXNUM_MCDI2 1020
>>> +
>>> +/* MC_CMD_FPGA_OP_GET_CAPABILITIES_IN msgrequest: Read bitmask of features
>>> + * supported in the FPGA image.
>>> + */
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_LEN 4
>>> +/* Sub-command code. Must be OP_GET_CAPABILITIES */
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_OP_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT msgresponse: Returns the version string.
>>> + */
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_LEN 4
>>> +/* Bit-mask of supported features. */
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_CAPABILITIES_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_CAPABILITIES_LEN 4
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_LBN 0
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_WIDTH 1
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_LBN 1
>>> +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_WIDTH 1
>>> +
>>> +/* MC_CMD_FPGA_OP_RESET_IN msgrequest: Perform a FPGA reset operation where
>>> + * supported.
>>> + */
>>> +#define MC_CMD_FPGA_OP_RESET_IN_LEN 4
>>> +/* Sub-command code. Must be OP_RESET */
>>> +#define MC_CMD_FPGA_OP_RESET_IN_OP_OFST 0
>>> +#define MC_CMD_FPGA_OP_RESET_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_FPGA_OP_RESET_OUT msgresponse */
>>> +#define MC_CMD_FPGA_OP_RESET_OUT_LEN 0
>>> +
>>> +/* MC_CMD_FPGA_OP_SELECT_FLASH_IN msgrequest: Set active FPGA flash device.
>>> + * Returns EINVAL if selected flash index does not exist on the platform under
>>> + * test.
>>> + */
>>> +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_LEN 8
>>> +/* Sub-command code. Must be OP_SELECT_FLASH */
>>> +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_OP_OFST 0
>>> +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_OP_LEN 4
>>> +/* Flash device identifier. */
>>> +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_FLASH_ID_OFST 4
>>> +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_FLASH_ID_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MC_CMD_FPGA_FLASH_INDEX */
>>> +
>>> +/* MC_CMD_FPGA_OP_SELECT_FLASH_OUT msgresponse */
>>> +#define MC_CMD_FPGA_OP_SELECT_FLASH_OUT_LEN 0
>>> +
>>> +/* MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN msgrequest: Get active FPGA flash device.
>>> + */
>>> +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_LEN 4
>>> +/* Sub-command code. Must be OP_GET_ACTIVE_FLASH */
>>> +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_OP_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT msgresponse: Returns flash identifier
>>> + * for current active flash.
>>> + */
>>> +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_LEN 4
>>> +/* Flash device identifier. */
>>> +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_FLASH_ID_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_FLASH_ID_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MC_CMD_FPGA_FLASH_INDEX */
>>> +
>>> +/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN msgrequest: Configure FPGA internal
>>> + * port, facing the ASIC
>>> + */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LEN 12
>>> +/* Sub-command code. Must be OP_SET_INTERNAL_LINK */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_OP_OFST 0
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_OP_LEN 4
>>> +/* Flags */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLAGS_OFST 4
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLAGS_LEN 4
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_OFST 4
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_LBN 0
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_WIDTH 2
>>> +/* enum: Unmodified, same as last state set by firmware */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_AUTO 0x0
>>> +/* enum: Configure link-up */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_UP 0x1
>>> +/* enum: Configure link-down */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_DOWN 0x2
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_OFST 4
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_LBN 2
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_WIDTH 1
>>> +/* Link speed to be applied on FPGA internal port MAC. */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_SPEED_OFST 8
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_SPEED_LEN 4
>>> +
>>> +/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_OUT msgresponse */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_OUT_LEN 0
>>> +
>>> +/* MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN msgrequest: Read FPGA internal port
>>> + * configuration and status
>>> + */
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_LEN 4
>>> +/* Sub-command code. Must be OP_GET_INTERNAL_LINK */
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_OP_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT msgresponse: Response format for read
>>> + * FPGA internal port configuration and status
>>> + */
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LEN 8
>>> +/* Flags */
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_FLAGS_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_FLAGS_LEN 4
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_LBN 0
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_WIDTH 2
>>> +/* Enum values, see field(s): */
>>> +/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN/FLAGS */
>>> +/* Link speed set on FPGA internal port MAC. */
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_SPEED_OFST 4
>>> +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_SPEED_LEN 4
>>> +
>>> +/* MC_CMD_FPGA_OP_GET_MAC_STATS_IN msgrequest: Get FPGA external port MAC
>>> + * statistics.
>>> + */
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_LEN 4
>>> +/* Sub-command code. Must be OP_GET_MAC_STATS. */
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_OP_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_OP_LEN 4
>>> +
>>> +/* MC_CMD_FPGA_OP_GET_MAC_STATS_OUT msgresponse */
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMIN 4
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMAX 252
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMAX_MCDI2 1020
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LEN(num) (4+8*(num))
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_NUM(len) (((len)-4)/8)
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_NUM_STATS_OFST 0
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_NUM_STATS_LEN 4
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_OFST 4
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LEN 8
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_OFST 4
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_LEN 4
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_LBN 32
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_WIDTH 32
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_OFST 8
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_LEN 4
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_LBN 64
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_WIDTH 32
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MINNUM 0
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MAXNUM 31
>>> +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MAXNUM_MCDI2 127
>>> +#define MC_CMD_FPGA_MAC_TX_TOTAL_PACKETS 0x0 /* enum */
>>> +#define MC_CMD_FPGA_MAC_TX_TOTAL_BYTES 0x1 /* enum */
>>> +#define MC_CMD_FPGA_MAC_TX_TOTAL_GOOD_PACKETS 0x2 /* enum */
>>> +#define MC_CMD_FPGA_MAC_TX_TOTAL_GOOD_BYTES 0x3 /* enum */
>>> +#define MC_CMD_FPGA_MAC_TX_BAD_FCS 0x4 /* enum */
>>> +#define MC_CMD_FPGA_MAC_TX_PAUSE 0x5 /* enum */
>>> +#define MC_CMD_FPGA_MAC_TX_USER_PAUSE 0x6 /* enum */
>>> +#define MC_CMD_FPGA_MAC_RX_TOTAL_PACKETS 0x7 /* enum */
>>> +#define MC_CMD_FPGA_MAC_RX_TOTAL_BYTES 0x8 /* enum */
>>> +#define MC_CMD_FPGA_MAC_RX_TOTAL_GOOD_PACKETS 0x9 /* enum */
>>> +#define MC_CMD_FPGA_MAC_RX_TOTAL_GOOD_BYTES 0xa /* enum */
>>> +#define MC_CMD_FPGA_MAC_RX_BAD_FCS 0xb /* enum */
>>> +#define MC_CMD_FPGA_MAC_RX_PAUSE 0xc /* enum */
>>> +#define MC_CMD_FPGA_MAC_RX_USER_PAUSE 0xd /* enum */
>>> +#define MC_CMD_FPGA_MAC_RX_UNDERSIZE 0xe /* enum */
>>> +#define MC_CMD_FPGA_MAC_RX_OVERSIZE 0xf /* enum */
>>> +#define MC_CMD_FPGA_MAC_RX_FRAMING_ERR 0x10 /* enum */
>>> +#define MC_CMD_FPGA_MAC_FEC_UNCORRECTED_ERRORS 0x11 /* enum */
>>> +#define MC_CMD_FPGA_MAC_FEC_CORRECTED_ERRORS 0x12 /* enum */
>>> +
>>> +/* MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN msgrequest: Configures the internal port
>>> + * MAC on the FPGA.
>>> + */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_LEN 20
>>> +/* Sub-command code. Must be OP_SET_INTERNAL_MAC. */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_OP_OFST 0
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_OP_LEN 4
>>> +/* Select which parameters to configure. */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CONTROL_OFST 4
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CONTROL_LEN 4
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_OFST 4
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_LBN 0
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_WIDTH 1
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_OFST 4
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_LBN 1
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_WIDTH 1
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_OFST 4
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_LBN 2
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_WIDTH 1
>>> +/* The MTU to be programmed into the MAC. */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_MTU_OFST 8
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_MTU_LEN 4
>>> +/* Drain Tx FIFO */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_DRAIN_OFST 12
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_DRAIN_LEN 4
>>> +/* flow control configuration. See MC_CMD_SET_MAC/MC_CMD_SET_MAC_IN/FCNTL. */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_FCNTL_OFST 16
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_FCNTL_LEN 4
>>> +
>>> +/* MC_CMD_FPGA_OP_SET_INTERNAL_MAC_OUT msgresponse */
>>> +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE
>>> + * This command is expected to be used on a U25 board with an MAE in the FPGA.
>>> + * It does not modify the operational state of the NIC. The modes are described
>>> + * in XN-200039-TC - U25 OVS packet formats.
>>> + */
>>> +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE 0x1c0
>>> +#undef MC_CMD_0x1c0_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x1c0_PRIVILEGE_CTG SRIOV_CTG_GENERAL
>>> +
>>> +/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_IN msgrequest */
>>> +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_IN_LEN 0
>>> +
>>> +/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT msgresponse */
>>> +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_LEN 4
>>> +/* The current link mode */
>>> +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_MODE_OFST 0
>>> +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_MODE_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MC_CMD_EXTERNAL_MAE_LINK_MODE */
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE
>>> + * This command is expected to be used on a U25 board with an MAE in the FPGA.
>>> + * The modes are described in XN-200039-TC - U25 OVS packet formats. This
>>> + * command will set the link between the FPGA and the X2 to the specified new
>>> + * mode. It will first enter bootstrap mode, make sure there are no packets in
>>> + * flight and then enter the requested mode. In order to make sure there are no
>>> + * packets in flight, it will flush the X2 TX path, the FPGA RX path from the
>>> + * X2, the FPGA TX path to the X2 and the X2 RX path. The driver is responsible
>>> + * for making sure there are no TX or RX descriptors posted on any TXQ or RXQ
>>> + * associated with the affected port before invoking this command. This command
>>> + * is run implicitly with MODE set to LEGACY when MC_CMD_DRV_ATTACH is
>>> + * executed.
>>> + */
>>> +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE 0x1c1
>>> +#undef MC_CMD_0x1c1_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x1c1_PRIVILEGE_CTG SRIOV_CTG_GENERAL
>>> +
>>> +/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN msgrequest */
>>> +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_LEN 4
>>> +/* The new link mode. */
>>> +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_MODE_OFST 0
>>> +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_MODE_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MC_CMD_EXTERNAL_MAE_LINK_MODE */
>>> +
>>> +/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_OUT msgresponse */
>>> +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_OUT_LEN 0
>>> +
>>> +
>>> +/***********************************/
>>> +/* MC_CMD_GET_BUFTBL_STATS
>>> + * Currently EF10 only. Read usage and limits for Buffer Table
>>> + */
>>> +#define MC_CMD_GET_BUFTBL_STATS 0x6a
>>> +#undef MC_CMD_0x6a_PRIVILEGE_CTG
>>> +
>>> +#define MC_CMD_0x6a_PRIVILEGE_CTG SRIOV_CTG_GENERAL
>>> +
>>> +/* MC_CMD_GET_BUFTBL_STATS_IN msgrequest */
>>> +#define MC_CMD_GET_BUFTBL_STATS_IN_LEN 0
>>> +
>>> +/* MC_CMD_GET_BUFTBL_STATS_OUT msgresponse */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_LEN 40
>>> +/* number of buffer table entries per set */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_SET_OFST 0
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_SET_LEN 4
>>> +/* number of buffer table entries per cluster */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_CLUSTER_OFST 4
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_CLUSTER_LEN 4
>>> +/* Maximum size buffer table can grow to, in clusters. On EF10, this can
>>> + * potentially vary depending on the size of the Descriptor Cache.
>>> + */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MAX_CLUSTERS_OFST 8
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MAX_CLUSTERS_LEN 4
>>> +/* High water mark for number of buffer table clusters which have been
>>> + * allocated.
>>> + */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HIGH_WATER_CLUSTERS_OFST 12
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HIGH_WATER_CLUSTERS_LEN 4
>>> +/* Number of free buffer table clusters on the free cluster list. */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_CLUSTERS_OFST 16
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_CLUSTERS_LEN 4
>>> +/* Number of free buffer table sets on the free set list. */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_SETS_OFST 20
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_SETS_LEN 4
>>> +/* Number of chunks of fully-used clusters allocated to the MC for EVQ, RXQ and
>>> + * TXQs.
>>> + */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_FULL_CLUSTERS_OFST 24
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_FULL_CLUSTERS_LEN 4
>>> +/* Number of chunks in partially-used clusters allocated to the MC for EVQ, RXQ
>>> + * and TXQs.
>>> + */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_PART_CLUSTERS_OFST 28
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_PART_CLUSTERS_LEN 4
>>> +/* Number of buffer table sets (chunks) allocated to the host via
>>> + * MC_CMD_ALLOC_BUFTBL_CHUNK.
>>> + */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HOST_SETS_OFST 32
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HOST_SETS_LEN 4
>>> +/* Maximum number of VIs per NIC. On EF10 this is the current value as used to
>>> + * size the Descriptor Cache in hardware.
>>> + */
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_VI_MAX_OFST 36
>>> +#define MC_CMD_GET_BUFTBL_STATS_OUT_VI_MAX_LEN 4
>>> +
>>> /* CLIENT_HANDLE structuredef: A client is an abstract entity that can make
>>> * requests of the device and that can own resources managed by the device.
>>> * Examples of clients include PCIe functions and dynamic clients. A client
>>> @@ -23899,8 +27825,8 @@
>>>
>>> /* SCHED_CREDIT_CHECK_RESULT structuredef */
>>> #define SCHED_CREDIT_CHECK_RESULT_LEN 16
>>> -/* The instance of the scheduler. Refer to XN-200389-AW for the location of
>>> - * these schedulers in the hardware.
>>> +/* The instance of the scheduler. Refer to XN-200389-AW (snic/hnic) and
>>> + * XN-200425-TC (cdx) for the location of these schedulers in the hardware.
>>> */
>>> #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_OFST 0
>>> #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_LEN 1
>>> @@ -23914,6 +27840,16 @@
>>> #define SCHED_CREDIT_CHECK_RESULT_DMAC_H2C 0x7 /* enum */
>>> #define SCHED_CREDIT_CHECK_RESULT_HUB_NET_B 0x8 /* enum */
>>> #define SCHED_CREDIT_CHECK_RESULT_HUB_NET_REPLAY 0x9 /* enum */
>>> +#define SCHED_CREDIT_CHECK_RESULT_ADAPTER_C2H_C 0xa /* enum */
>>> +#define SCHED_CREDIT_CHECK_RESULT_A2_H2C_C 0xb /* enum */
>>> +#define SCHED_CREDIT_CHECK_RESULT_A3_SOFT_ADAPTOR_C 0xc /* enum */
>>> +#define SCHED_CREDIT_CHECK_RESULT_A4_DPU_WRITE_C 0xd /* enum */
>>> +#define SCHED_CREDIT_CHECK_RESULT_JRC_RRU 0xe /* enum */
>>> +#define SCHED_CREDIT_CHECK_RESULT_CDM_SINK 0xf /* enum */
>>> +#define SCHED_CREDIT_CHECK_RESULT_PCIE_SINK 0x10 /* enum */
>>> +#define SCHED_CREDIT_CHECK_RESULT_UPORT_SINK 0x11 /* enum */
>>> +#define SCHED_CREDIT_CHECK_RESULT_PSX_SINK 0x12 /* enum */
>>> +#define SCHED_CREDIT_CHECK_RESULT_A5_DPU_READ_C 0x13 /* enum */
>>> #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_LBN 0
>>> #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_WIDTH 8
>>> /* The type of node that this result refers to. */
>>> @@ -23923,6 +27859,10 @@
>>> #define SCHED_CREDIT_CHECK_RESULT_DEST 0x0
>>> /* enum: Source node */
>>> #define SCHED_CREDIT_CHECK_RESULT_SOURCE 0x1
>>> +/* enum: Destination node credit type 1 (new to the Keystone schedulers, see
>>> + * SF-120268-TC)
>>> + */
>>> +#define SCHED_CREDIT_CHECK_RESULT_DEST_CREDIT1 0x2
>>> #define SCHED_CREDIT_CHECK_RESULT_NODE_TYPE_LBN 8
>>> #define SCHED_CREDIT_CHECK_RESULT_NODE_TYPE_WIDTH 8
>>> /* Level of node in scheduler hierarchy (level 0 is the bottom of the
>>> @@ -26076,6 +30016,26 @@
>>> #define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MINNUM 0
>>> #define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MAXNUM 4
>>> #define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MAXNUM_MCDI2 19
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_OFST 4
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LEN 8
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_OFST 4
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_LEN 4
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_LBN 32
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_WIDTH 32
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_OFST 8
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_LEN 4
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_LBN 64
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_WIDTH 32
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_PF_OFST 4
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_PF_LEN 2
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_VF_OFST 6
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_VF_LEN 2
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_INTF_OFST 8
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_INTF_LEN 4
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_PERSONALITY_OFST 12
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_PERSONALITY_LEN 4
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_LABEL_OFST 16
>>> +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_LABEL_LEN 40
>>>
>>>
>>> /***********************************/
>>> @@ -27350,7 +31310,7 @@
>>> /* MAE_MPORT_SELECTOR structuredef: MPORTS are identified by an opaque unsigned
>>> * integer value (mport_id) that is guaranteed to be representable within
>>> * 32-bits or within any NIC interface field that needs store the value
>>> - * (whichever is narrowers). This selector structure provides a stable way to
>>> + * (whichever is narrower). This selector structure provides a stable way to
>>> * refer to m-ports.
>>> */
>>> #define MAE_MPORT_SELECTOR_LEN 4
>>> @@ -27425,10 +31385,22 @@
>>> #define MAE_MPORT_SELECTOR_FLAT_WIDTH 32
>>>
>>> /* MAE_LINK_ENDPOINT_SELECTOR structuredef: Structure that identifies a real or
>>> - * virtual network port by MAE port and link end
>>> + * virtual network port by MAE port and link end. Intended to be used by
>>> + * network port MCDI commands. Setting FLAT to MAE_LINK_ENDPOINT_COMPAT is
>>> + * equivalent to using the previous version of the command. Not all possible
>>> + * combinations of MPORT_END and MPORT_SELECTOR in MAE_LINK_ENDPOINT_SELECTOR
>>> + * will work in all circumstances. 1. Some will always work (e.g. a VF can
>>> + * always address its logical MAC using MPORT_SELECTOR=ASSIGNED,LINK_END=VNIC),
>>> + * 2. Some are not meaningful and will always fail with EINVAL (e.g. attempting
>>> + * to address the VNIC end of a link to a physical port), 3. Some are
>>> + * meaningful but require the MCDI client to have the required permission and
>>> + * fail with EPERM otherwise (e.g. trying to set the MAC on a VF the caller
>>> + * cannot administer), and 4. Some could be implementation-specific and fail
>>> + * with ENOTSUP if not available (no examples exist right now). See
>>> + * SF-123581-TC section 4.3 for more details.
>>> */
>>> #define MAE_LINK_ENDPOINT_SELECTOR_LEN 8
>>> -/* The MAE MPORT of interest */
>>> +/* Identifier for the MAE MPORT of interest */
>>> #define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_OFST 0
>>> #define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_LEN 4
>>> #define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_LBN 0
>>> @@ -27829,6 +31801,8 @@
>>> #define MC_CMD_MAE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM_MCDI2 253
>>> /* enum: A counter ID that is guaranteed never to represent a real counter */
>>> #define MC_CMD_MAE_COUNTER_ALLOC_OUT_COUNTER_ID_NULL 0xffffffff
>>> +/* Other enum values, see field(s): */
>>> +/* MAE_COUNTER_ID */
>>>
>>>
>>> /***********************************/
>>> @@ -28266,6 +32240,24 @@
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_OFST 0
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_LBN 14
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_LBN 15
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_LBN 16
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_LBN 18
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_LBN 19
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_LBN 20
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_WIDTH 1
>>> /* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_VLAN0_TCI_BE_OFST 4
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_VLAN0_TCI_BE_LEN 2
>>> @@ -28291,19 +32283,23 @@
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DELIVER_OFST 20
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DELIVER_LEN 4
>>> /* Allows an action set to trigger several counter updates. Set to
>>> - * COUNTER_LIST_ID_NULL to request no counter action.
>>> + * MAE_COUNTER_ID_NULL to request no counter action.
>>> */
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_LIST_ID_OFST 24
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_LIST_ID_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MAE_COUNTER_ID */
>>> /* If a driver only wished to update one counter within this action set, then
>>> * it can supply a COUNTER_ID instead of allocating a single-element counter
>>> * list. The ID must have been allocated with COUNTER_TYPE=AR. This field
>>> - * should be set to COUNTER_ID_NULL if this behaviour is not required. It is
>>> - * not valid to supply a non-NULL value for both COUNTER_LIST_ID and
>>> + * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
>>> + * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
>>> * COUNTER_ID.
>>> */
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_ID_OFST 28
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_ID_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MAE_COUNTER_ID */
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_MARK_VALUE_OFST 32
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_MARK_VALUE_LEN 4
>>> /* Set to MAC_ID_NULL to request no source MAC replacement. */
>>> @@ -28347,6 +32343,24 @@
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_OFST 0
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_LBN 14
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_LBN 15
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_LBN 16
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_LBN 18
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_LBN 19
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_LBN 20
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_WIDTH 1
>>> /* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_VLAN0_TCI_BE_OFST 4
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_VLAN0_TCI_BE_LEN 2
>>> @@ -28372,19 +32386,23 @@
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DELIVER_OFST 20
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DELIVER_LEN 4
>>> /* Allows an action set to trigger several counter updates. Set to
>>> - * COUNTER_LIST_ID_NULL to request no counter action.
>>> + * MAE_COUNTER_ID_NULL to request no counter action.
>>> */
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_LIST_ID_OFST 24
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_LIST_ID_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MAE_COUNTER_ID */
>>> /* If a driver only wished to update one counter within this action set, then
>>> * it can supply a COUNTER_ID instead of allocating a single-element counter
>>> * list. The ID must have been allocated with COUNTER_TYPE=AR. This field
>>> - * should be set to COUNTER_ID_NULL if this behaviour is not required. It is
>>> - * not valid to supply a non-NULL value for both COUNTER_LIST_ID and
>>> + * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
>>> + * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
>>> * COUNTER_ID.
>>> */
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_ID_OFST 28
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_ID_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MAE_COUNTER_ID */
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_MARK_VALUE_OFST 32
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_MARK_VALUE_LEN 4
>>> /* Set to MAC_ID_NULL to request no source MAC replacement. */
>>> @@ -28437,6 +32455,172 @@
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_ECN_ECT_1_TO_CE_LBN 6
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_ECN_ECT_1_TO_CE_WIDTH 1
>>>
>>> +/* MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN msgrequest: Only supported if
>>> + * MAE_ACTION_SET_ALLOC_V3_SUPPORTED is advertised in
>>> + * MC_CMD_GET_CAPABILITIES_V10_OUT.
>>> + */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LEN 53
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAGS_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAGS_LEN 4
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_LBN 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_WIDTH 2
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_LBN 4
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_WIDTH 2
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_LBN 8
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_LBN 9
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_LBN 10
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_LBN 11
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_LBN 12
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_LBN 13
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_LBN 14
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_LBN 15
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_LBN 16
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_LBN 18
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_LBN 19
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_OFST 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_LBN 20
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_WIDTH 1
>>> +/* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_TCI_BE_OFST 4
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_TCI_BE_LEN 2
>>> +/* If VLAN_PUSH >= 1, TPID value to be inserted as outermost VLAN. */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_PROTO_BE_OFST 6
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_PROTO_BE_LEN 2
>>> +/* If VLAN_PUSH == 2, inner TCI value to be inserted. */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_TCI_BE_OFST 8
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_TCI_BE_LEN 2
>>> +/* If VLAN_PUSH == 2, inner TPID value to be inserted. */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_PROTO_BE_OFST 10
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_PROTO_BE_LEN 2
>>> +/* Reserved. Ignored by firmware. Should be set to zero or 0xffffffff. */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RSVD_OFST 12
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RSVD_LEN 4
>>> +/* Set to ENCAP_HEADER_ID_NULL to request no encap action */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ENCAP_HEADER_ID_OFST 16
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ENCAP_HEADER_ID_LEN 4
>>> +/* An m-port selector identifying the m-port that the modified packet should be
>>> + * delivered to. Set to MPORT_SELECTOR_NULL to request no delivery of the
>>> + * packet.
>>> + */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DELIVER_OFST 20
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DELIVER_LEN 4
>>> +/* Allows an action set to trigger several counter updates. Set to
>>> + * MAE_COUNTER_ID_NULL to request no counter action.
>>> + */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_LIST_ID_OFST 24
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_LIST_ID_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MAE_COUNTER_ID */
>>> +/* If a driver only wished to update one counter within this action set, then
>>> + * it can supply a COUNTER_ID instead of allocating a single-element counter
>>> + * list. The ID must have been allocated with COUNTER_TYPE=AR. This field
>>> + * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
>>> + * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
>>> + * COUNTER_ID.
>>> + */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_ID_OFST 28
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_ID_LEN 4
>>> +/* Enum values, see field(s): */
>>> +/* MAE_COUNTER_ID */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_VALUE_OFST 32
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_VALUE_LEN 4
>>> +/* Set to MAC_ID_NULL to request no source MAC replacement. */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SRC_MAC_ID_OFST 36
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SRC_MAC_ID_LEN 4
>>> +/* Set to MAC_ID_NULL to request no destination MAC replacement. */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DST_MAC_ID_OFST 40
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DST_MAC_ID_LEN 4
>>> +/* Source m-port ID to be reported for DO_SET_SRC_MPORT action. */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_REPORTED_SRC_MPORT_OFST 44
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_REPORTED_SRC_MPORT_LEN 4
>>> +/* Actions for modifying the Differentiated Services Code-Point (DSCP) bits
>>> + * within IPv4 and IPv6 headers.
>>> + */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_CONTROL_OFST 48
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_CONTROL_LEN 2
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_OFST 48
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_LBN 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_OFST 48
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_LBN 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_OFST 48
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_LBN 2
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_OFST 48
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_LBN 3
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_WIDTH 6
>>> +/* Actions for modifying the Explicit Congestion Notification (ECN) bits within
>>> + * IPv4 and IPv6 headers.
>>> + */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_CONTROL_OFST 50
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_CONTROL_LEN 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_OFST 50
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_LBN 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_OFST 50
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_LBN 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_OFST 50
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_LBN 2
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_OFST 50
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_LBN 3
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_WIDTH 2
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_OFST 50
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_LBN 5
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_OFST 50
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_LBN 6
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_WIDTH 1
>>> +/* Actions for overwriting CH_ROUTE subfields. */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OVERWRITE_OFST 51
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OVERWRITE_LEN 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_OFST 51
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_LBN 0
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_OFST 51
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_LBN 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_OFST 51
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_LBN 2
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_WIDTH 1
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_OFST 51
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_LBN 3
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_WIDTH 1
>>> +/* Override outgoing CH_VC to network port for DO_SET_NET_CHAN action. Cannot
>>> + * be used in conjunction with DO_SET_SRC_MPORT action.
>>> + */
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_NET_CHAN_OFST 52
>>> +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_NET_CHAN_LEN 1
>>> +
>>> /* MC_CMD_MAE_ACTION_SET_ALLOC_OUT msgresponse */
>>> #define MC_CMD_MAE_ACTION_SET_ALLOC_OUT_LEN 4
>>> /* The MSB of the AS_ID is guaranteed to be clear if the ID is not
>>> diff --git a/drivers/net/ethernet/sfc/mcdi_vdpa.c b/drivers/net/ethernet/sfc/mcdi_vdpa.c
>>> index b9668545ca01..f9ee61b84320 100644
>>> --- a/drivers/net/ethernet/sfc/mcdi_vdpa.c
>>> +++ b/drivers/net/ethernet/sfc/mcdi_vdpa.c
>>> @@ -14,14 +14,6 @@
>>> #include "mcdi_vdpa.h"
>>> #include "mcdi_pcol.h"
>>>
>>> -/* The value of target_vf in virtio MC commands like
>>> - * virtqueue create, delete and get doorbell offset should
>>> - * contain the VF index when the calling function is a PF
>>> - * and VF_NULL (0xFFFF) otherwise. As the vDPA driver invokes
>>> - * MC commands in context of the VF, it uses VF_NULL.
>>> - */
>>> -#define MC_CMD_VIRTIO_TARGET_VF_NULL 0xFFFF
>>> -
>>> struct efx_vring_ctx *efx_vdpa_vring_init(struct efx_nic *efx, u32 vi,
>>> enum ef100_vdpa_vq_type vring_type)
>>> {
>>> @@ -47,7 +39,7 @@ struct efx_vring_ctx *efx_vdpa_vring_init(struct efx_nic *efx, u32 vi,
>>> }
>>>
>>> vring_ctx->efx = efx;
>>> - vring_ctx->vf_index = MC_CMD_VIRTIO_TARGET_VF_NULL;
>>> + vring_ctx->vf_index = MC_CMD_VIRTIO_INIT_QUEUE_REQ_VF_NULL;
>>> vring_ctx->vi_index = vi;
>>> vring_ctx->mcdi_vring_type = queue_cmd;
>>> return vring_ctx;

2023-03-13 15:10:20

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 06/14] sfc: implement vDPA management device operations


On 3/8/23 22:11, Martin Habets wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 07, 2023 at 05:06:08PM +0530, Gautam Dawar wrote:
>> To allow vDPA device creation and deletion, add a vDPA management
>> device per function. Currently, the vDPA devices can be created
>> only on a VF. Also, for now only network class of vDPA devices
>> are supported.
>>
>> Signed-off-by: Gautam Dawar <[email protected]>
>> ---
>> drivers/net/ethernet/sfc/Makefile | 2 +-
>> drivers/net/ethernet/sfc/ef10.c | 2 +-
>> drivers/net/ethernet/sfc/ef100_nic.c | 27 ++-
>> drivers/net/ethernet/sfc/ef100_nic.h | 9 +
>> drivers/net/ethernet/sfc/ef100_vdpa.c | 228 ++++++++++++++++++++++
>> drivers/net/ethernet/sfc/ef100_vdpa.h | 84 ++++++++
>> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 30 +++
>> drivers/net/ethernet/sfc/mcdi_functions.c | 9 +-
>> drivers/net/ethernet/sfc/mcdi_functions.h | 3 +-
>> drivers/net/ethernet/sfc/net_driver.h | 6 +
>> 10 files changed, 393 insertions(+), 7 deletions(-)
>> create mode 100644 drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>
>> diff --git a/drivers/net/ethernet/sfc/Makefile b/drivers/net/ethernet/sfc/Makefile
>> index 3a2bb98d1c3f..bd8ba588b968 100644
>> --- a/drivers/net/ethernet/sfc/Makefile
>> +++ b/drivers/net/ethernet/sfc/Makefile
>> @@ -12,7 +12,7 @@ sfc-$(CONFIG_SFC_MTD) += mtd.o
>> sfc-$(CONFIG_SFC_SRIOV) += sriov.o ef10_sriov.o ef100_sriov.o ef100_rep.o \
>> mae.o tc.o tc_bindings.o tc_counters.o
>>
>> -sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o ef100_vdpa.o
>> +sfc-$(CONFIG_SFC_VDPA) += mcdi_vdpa.o ef100_vdpa.o ef100_vdpa_ops.o
>> obj-$(CONFIG_SFC) += sfc.o
>>
>> obj-$(CONFIG_SFC_FALCON) += falcon/
>> diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
>> index 7022fb2005a2..366ecd3c80b1 100644
>> --- a/drivers/net/ethernet/sfc/ef10.c
>> +++ b/drivers/net/ethernet/sfc/ef10.c
>> @@ -589,7 +589,7 @@ static int efx_ef10_probe(struct efx_nic *efx)
>> if (rc)
>> goto fail4;
>>
>> - rc = efx_get_pf_index(efx, &nic_data->pf_index);
>> + rc = efx_get_fn_info(efx, &nic_data->pf_index, NULL);
>> if (rc)
>> goto fail5;
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
>> index 8a9fff239d07..bda4fcbe1126 100644
>> --- a/drivers/net/ethernet/sfc/ef100_nic.c
>> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
>> @@ -1164,7 +1164,7 @@ static int ef100_probe_main(struct efx_nic *efx)
>> if (rc)
>> goto fail;
>>
>> - rc = efx_get_pf_index(efx, &nic_data->pf_index);
>> + rc = efx_get_fn_info(efx, &nic_data->pf_index, &nic_data->vf_index);
>> if (rc)
>> goto fail;
>>
>> @@ -1280,13 +1280,36 @@ int ef100_probe_netdev_pf(struct efx_nic *efx)
>>
>> int ef100_probe_vf(struct efx_nic *efx)
>> {
>> - return ef100_probe_main(efx);
>> +#if defined(CONFIG_SFC_VDPA)
>> + struct ef100_nic_data *nic_data;
>> + int err;
>> +#endif
> This looks like an opportunity to use __maybe_unused in stead of the #ifdef.
> See section "Conditional Compilation" in Documentation/process/coding-style.rst
Yeah, right. Will make the change.
>
>> + int rc;
>> +
>> + rc = ef100_probe_main(efx);
>> + if (rc)
>> + return rc;
>> +
>> +#if defined(CONFIG_SFC_VDPA)
> and use IS_ENABLED() here as per that same section.
Ok
>
>> + nic_data = efx->nic_data;
>> + if (nic_data->vdpa_supported) {
>> + err = ef100_vdpa_register_mgmtdev(efx);
>> + if (err)
>> + pci_warn(efx->pci_dev,
>> + "vdpa_register_mgmtdev failed, rc: %d\n", err);
>> + }
>> +#endif
>> + return 0;
>> }
>>
>> void ef100_remove(struct efx_nic *efx)
>> {
>> struct ef100_nic_data *nic_data = efx->nic_data;
>>
>> +#if defined(CONFIG_SFC_VDPA)
>> + if (nic_data->vdpa_supported)
>> + ef100_vdpa_unregister_mgmtdev(efx);
>> +#endif
> Same comment here.

Will do.

Thanks

>
> Martin
>
>> if (IS_ENABLED(CONFIG_SFC_SRIOV) && efx->mae) {
>> efx_ef100_fini_reps(efx);
>> efx_fini_mae(efx);
>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h
>> index 117a73d0795c..71404bfc2a5a 100644
>> --- a/drivers/net/ethernet/sfc/ef100_nic.h
>> +++ b/drivers/net/ethernet/sfc/ef100_nic.h
>> @@ -68,6 +68,13 @@ enum ef100_bar_config {
>> EF100_BAR_CONFIG_VDPA,
>> };
>>
>> +#ifdef CONFIG_SFC_VDPA
>> +enum ef100_vdpa_class {
>> + EF100_VDPA_CLASS_NONE,
>> + EF100_VDPA_CLASS_NET,
>> +};
>> +#endif
>> +
>> struct ef100_nic_data {
>> struct efx_nic *efx;
>> struct efx_buffer mcdi_buf;
>> @@ -75,9 +82,11 @@ struct ef100_nic_data {
>> u32 datapath_caps2;
>> u32 datapath_caps3;
>> unsigned int pf_index;
>> + unsigned int vf_index;
>> u16 warm_boot_count;
>> #ifdef CONFIG_SFC_VDPA
>> bool vdpa_supported; /* true if vdpa is supported on this PCIe FN */
>> + enum ef100_vdpa_class vdpa_class;
>> #endif
>> u8 port_id[ETH_ALEN];
>> DECLARE_BITMAP(evq_phases, EFX_MAX_CHANNELS);
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> index 268c973f7376..4c5a98c9d6c3 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> @@ -10,11 +10,17 @@
>> #include <linux/err.h>
>> #include <linux/vdpa.h>
>> #include <linux/virtio_net.h>
>> +#include <uapi/linux/vdpa.h>
>> #include "ef100_vdpa.h"
>> #include "mcdi_vdpa.h"
>> #include "mcdi_filters.h"
>> #include "ef100_netdev.h"
>>
>> +static struct virtio_device_id ef100_vdpa_id_table[] = {
>> + { .device = VIRTIO_ID_NET, .vendor = PCI_VENDOR_ID_REDHAT_QUMRANET },
>> + { 0 },
>> +};
>> +
>> int ef100_vdpa_init(struct efx_probe_data *probe_data)
>> {
>> struct efx_nic *efx = &probe_data->efx;
>> @@ -41,17 +47,239 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data)
>> return rc;
>> }
>>
>> +static void ef100_vdpa_delete(struct efx_nic *efx)
>> +{
>> + if (efx->vdpa_nic) {
>> + /* replace with _vdpa_unregister_device later */
>> + put_device(&efx->vdpa_nic->vdpa_dev.dev);
>> + }
>> +}
>> +
>> void ef100_vdpa_fini(struct efx_probe_data *probe_data)
>> {
>> struct efx_nic *efx = &probe_data->efx;
>> + struct ef100_nic_data *nic_data;
>>
>> if (efx->state != STATE_VDPA && efx->state != STATE_DISABLED) {
>> pci_err(efx->pci_dev, "Invalid efx state %u", efx->state);
>> return;
>> }
>>
>> + /* Handle vdpa device deletion, if not done explicitly */
>> + ef100_vdpa_delete(efx);
>> + nic_data = efx->nic_data;
>> + nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
>> efx->state = STATE_PROBED;
>> down_write(&efx->filter_sem);
>> efx_mcdi_filter_table_remove(efx);
>> up_write(&efx->filter_sem);
>> }
>> +
>> +static int get_net_config(struct ef100_vdpa_nic *vdpa_nic)
>> +{
>> + struct efx_nic *efx = vdpa_nic->efx;
>> + u16 mtu;
>> + int rc;
>> +
>> + vdpa_nic->net_config.max_virtqueue_pairs =
>> + cpu_to_efx_vdpa16(vdpa_nic, vdpa_nic->max_queue_pairs);
>> +
>> + rc = efx_vdpa_get_mtu(efx, &mtu);
>> + if (rc) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: Get MTU for vf:%u failed:%d\n", __func__,
>> + vdpa_nic->vf_index, rc);
>> + return rc;
>> + }
>> + vdpa_nic->net_config.mtu = cpu_to_efx_vdpa16(vdpa_nic, mtu);
>> + vdpa_nic->net_config.status = cpu_to_efx_vdpa16(vdpa_nic,
>> + VIRTIO_NET_S_LINK_UP);
>> + return 0;
>> +}
>> +
>> +static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> + const char *dev_name,
>> + enum ef100_vdpa_class dev_type,
>> + const u8 *mac)
>> +{
>> + struct ef100_nic_data *nic_data = efx->nic_data;
>> + struct ef100_vdpa_nic *vdpa_nic;
>> + int rc;
>> +
>> + nic_data->vdpa_class = dev_type;
>> + vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
>> + vdpa_dev, &efx->pci_dev->dev,
>> + &ef100_vdpa_config_ops,
>> + 1, 1,
>> + dev_name, false);
>> + if (!vdpa_nic) {
>> + pci_err(efx->pci_dev,
>> + "vDPA device allocation failed for vf: %u\n",
>> + nic_data->vf_index);
>> + nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
>> + return ERR_PTR(-ENOMEM);
>> + }
>> +
>> + mutex_init(&vdpa_nic->lock);
>> + efx->vdpa_nic = vdpa_nic;
>> + vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
>> + vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
>> + vdpa_nic->efx = efx;
>> + vdpa_nic->pf_index = nic_data->pf_index;
>> + vdpa_nic->vf_index = nic_data->vf_index;
>> + vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
>> + vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;
>> +
>> + rc = get_net_config(vdpa_nic);
>> + if (rc)
>> + goto err_put_device;
>> +
>> + if (mac) {
>> + ether_addr_copy(vdpa_nic->mac_address, mac);
>> + vdpa_nic->mac_configured = true;
>> + }
>> +
>> + /* _vdpa_register_device when its ready */
>> +
>> + return vdpa_nic;
>> +
>> +err_put_device:
>> + /* put_device invokes ef100_vdpa_free */
>> + put_device(&vdpa_nic->vdpa_dev.dev);
>> + return ERR_PTR(rc);
>> +}
>> +
>> +static void ef100_vdpa_net_dev_del(struct vdpa_mgmt_dev *mgmt_dev,
>> + struct vdpa_device *vdev)
>> +{
>> + struct ef100_nic_data *nic_data;
>> + struct efx_nic *efx;
>> + int rc;
>> +
>> + efx = pci_get_drvdata(to_pci_dev(mgmt_dev->device));
>> + nic_data = efx->nic_data;
>> +
>> + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
>> + if (rc)
>> + pci_err(efx->pci_dev,
>> + "set_bar_config EF100 failed, err: %d\n", rc);
>> + else
>> + pci_dbg(efx->pci_dev,
>> + "vdpa net device deleted, vf: %u\n",
>> + nic_data->vf_index);
>> +}
>> +
>> +static int ef100_vdpa_net_dev_add(struct vdpa_mgmt_dev *mgmt_dev,
>> + const char *name,
>> + const struct vdpa_dev_set_config *config)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic;
>> + struct ef100_nic_data *nic_data;
>> + const u8 *mac = NULL;
>> + struct efx_nic *efx;
>> + int rc, err;
>> +
>> + if (config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
>> + if (!is_valid_ether_addr(config->net.mac)) {
>> + pci_err(efx->pci_dev, "Invalid MAC address %pM\n",
>> + config->net.mac);
>> + return -EINVAL;
>> + }
>> + mac = (const u8 *)config->net.mac;
>> + }
>> +
>> + efx = pci_get_drvdata(to_pci_dev(mgmt_dev->device));
>> + if (efx->vdpa_nic) {
>> + pci_warn(efx->pci_dev,
>> + "vDPA device already exists on this VF\n");
>> + return -EEXIST;
>> + }
>> +
>> + nic_data = efx->nic_data;
>> +
>> + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_VDPA);
>> + if (rc) {
>> + pci_err(efx->pci_dev,
>> + "set_bar_config vDPA failed, err: %d\n", rc);
>> + goto err_set_bar_config;
>> + }
>> +
>> + vdpa_nic = ef100_vdpa_create(efx, name, EF100_VDPA_CLASS_NET, mac);
>> + if (IS_ERR(vdpa_nic)) {
>> + pci_err(efx->pci_dev,
>> + "vDPA device creation failed, vf: %u, err: %ld\n",
>> + nic_data->vf_index, PTR_ERR(vdpa_nic));
>> + rc = PTR_ERR(vdpa_nic);
>> + goto err_set_bar_config;
>> + } else {
>> + pci_dbg(efx->pci_dev,
>> + "vdpa net device created, vf: %u\n",
>> + nic_data->vf_index);
>> + }
>> +
>> + return 0;
>> +
>> +err_set_bar_config:
>> + err = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
>> + if (err)
>> + pci_err(efx->pci_dev,
>> + "set_bar_config EF100 failed, err: %d\n", err);
>> +
>> + return rc;
>> +}
>> +
>> +static const struct vdpa_mgmtdev_ops ef100_vdpa_net_mgmtdev_ops = {
>> + .dev_add = ef100_vdpa_net_dev_add,
>> + .dev_del = ef100_vdpa_net_dev_del
>> +};
>> +
>> +int ef100_vdpa_register_mgmtdev(struct efx_nic *efx)
>> +{
>> + struct vdpa_mgmt_dev *mgmt_dev;
>> + u64 features;
>> + int rc;
>> +
>> + mgmt_dev = kzalloc(sizeof(*mgmt_dev), GFP_KERNEL);
>> + if (!mgmt_dev)
>> + return -ENOMEM;
>> +
>> + rc = efx_vdpa_get_features(efx, EF100_VDPA_DEVICE_TYPE_NET, &features);
>> + if (rc) {
>> + pci_err(efx->pci_dev, "%s: MCDI get features error:%d\n",
>> + __func__, rc);
>> + goto err_get_features;
>> + }
>> +
>> + efx->mgmt_dev = mgmt_dev;
>> + mgmt_dev->device = &efx->pci_dev->dev;
>> + mgmt_dev->id_table = ef100_vdpa_id_table;
>> + mgmt_dev->ops = &ef100_vdpa_net_mgmtdev_ops;
>> + mgmt_dev->supported_features = features;
>> + mgmt_dev->max_supported_vqs = EF100_VDPA_MAX_QUEUES_PAIRS * 2;
>> + mgmt_dev->config_attr_mask = BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR);
>> +
>> + rc = vdpa_mgmtdev_register(mgmt_dev);
>> + if (rc) {
>> + pci_err(efx->pci_dev,
>> + "vdpa_mgmtdev_register failed, err: %d\n", rc);
>> + goto err_mgmtdev_register;
>> + }
>> +
>> + return 0;
>> +
>> +err_mgmtdev_register:
>> +err_get_features:
>> + kfree(mgmt_dev);
>> + efx->mgmt_dev = NULL;
>> +
>> + return rc;
>> +}
>> +
>> +void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx)
>> +{
>> + if (efx->mgmt_dev) {
>> + vdpa_mgmtdev_unregister(efx->mgmt_dev);
>> + kfree(efx->mgmt_dev);
>> + efx->mgmt_dev = NULL;
>> + }
>> +}
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> index ccc5eb0a2a84..1101b30f56e7 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> @@ -17,6 +17,24 @@
>>
>> #if defined(CONFIG_SFC_VDPA)
>>
>> +/* Max queue pairs currently supported */
>> +#define EF100_VDPA_MAX_QUEUES_PAIRS 1
>> +
>> +/**
>> + * enum ef100_vdpa_nic_state - possible states for a vDPA NIC
>> + *
>> + * @EF100_VDPA_STATE_INITIALIZED: State after vDPA NIC created
>> + * @EF100_VDPA_STATE_NEGOTIATED: State after feature negotiation
>> + * @EF100_VDPA_STATE_STARTED: State after driver ok
>> + * @EF100_VDPA_STATE_NSTATES: Number of VDPA states
>> + */
>> +enum ef100_vdpa_nic_state {
>> + EF100_VDPA_STATE_INITIALIZED,
>> + EF100_VDPA_STATE_NEGOTIATED,
>> + EF100_VDPA_STATE_STARTED,
>> + EF100_VDPA_STATE_NSTATES
>> +};
>> +
>> enum ef100_vdpa_device_type {
>> EF100_VDPA_DEVICE_TYPE_NET,
>> };
>> @@ -27,7 +45,73 @@ enum ef100_vdpa_vq_type {
>> EF100_VDPA_VQ_NTYPES
>> };
>>
>> +/**
>> + * struct ef100_vdpa_nic - vDPA NIC data structure
>> + *
>> + * @vdpa_dev: vdpa_device object which registers on the vDPA bus.
>> + * @vdpa_state: NIC state machine governed by ef100_vdpa_nic_state
>> + * @efx: pointer to the VF's efx_nic object
>> + * @lock: Managing access to vdpa config operations
>> + * @pf_index: PF index of the vDPA VF
>> + * @vf_index: VF index of the vDPA VF
>> + * @status: device status as per VIRTIO spec
>> + * @features: negotiated feature bits
>> + * @max_queue_pairs: maximum number of queue pairs supported
>> + * @net_config: virtio_net_config data
>> + * @mac_address: mac address of interface associated with this vdpa device
>> + * @mac_configured: true after MAC address is configured
>> + */
>> +struct ef100_vdpa_nic {
>> + struct vdpa_device vdpa_dev;
>> + enum ef100_vdpa_nic_state vdpa_state;
>> + struct efx_nic *efx;
>> + /* for synchronizing access to vdpa config operations */
>> + struct mutex lock;
>> + u32 pf_index;
>> + u32 vf_index;
>> + u8 status;
>> + u64 features;
>> + u32 max_queue_pairs;
>> + struct virtio_net_config net_config;
>> + u8 *mac_address;
>> + bool mac_configured;
>> +};
>> +
>> int ef100_vdpa_init(struct efx_probe_data *probe_data);
>> void ef100_vdpa_fini(struct efx_probe_data *probe_data);
>> +int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
>> +void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
>> +
>> +static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
>> +{
>> + return virtio_legacy_is_little_endian() ||
>> + (vdpa_nic->features & (1ULL << VIRTIO_F_VERSION_1));
>> +}
>> +
>> +static inline u16 efx_vdpa16_to_cpu(struct ef100_vdpa_nic *vdpa_nic,
>> + __virtio16 val)
>> +{
>> + return __virtio16_to_cpu(efx_vdpa_is_little_endian(vdpa_nic), val);
>> +}
>> +
>> +static inline __virtio16 cpu_to_efx_vdpa16(struct ef100_vdpa_nic *vdpa_nic,
>> + u16 val)
>> +{
>> + return __cpu_to_virtio16(efx_vdpa_is_little_endian(vdpa_nic), val);
>> +}
>> +
>> +static inline u32 efx_vdpa32_to_cpu(struct ef100_vdpa_nic *vdpa_nic,
>> + __virtio32 val)
>> +{
>> + return __virtio32_to_cpu(efx_vdpa_is_little_endian(vdpa_nic), val);
>> +}
>> +
>> +static inline __virtio32 cpu_to_efx_vdpa32(struct ef100_vdpa_nic *vdpa_nic,
>> + u32 val)
>> +{
>> + return __cpu_to_virtio32(efx_vdpa_is_little_endian(vdpa_nic), val);
>> +}
>> +
>> +extern const struct vdpa_config_ops ef100_vdpa_config_ops;
>> #endif /* CONFIG_SFC_VDPA */
>> #endif /* __EF100_VDPA_H__ */
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> new file mode 100644
>> index 000000000000..f1ce011adc43
>> --- /dev/null
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> @@ -0,0 +1,30 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/* Driver for AMD network controllers and boards
>> + * Copyright(C) 2023, Advanced Micro Devices, Inc.
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License version 2 as published
>> + * by the Free Software Foundation, incorporated herein by reference.
>> + */
>> +
>> +#include <linux/vdpa.h>
>> +#include "ef100_vdpa.h"
>> +
>> +static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
>> +{
>> + return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
>> +}
>> +
>> +static void ef100_vdpa_free(struct vdpa_device *vdev)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (vdpa_nic) {
>> + mutex_destroy(&vdpa_nic->lock);
>> + vdpa_nic->efx->vdpa_nic = NULL;
>> + }
>> +}
>> +
>> +const struct vdpa_config_ops ef100_vdpa_config_ops = {
>> + .free = ef100_vdpa_free,
>> +};
>> diff --git a/drivers/net/ethernet/sfc/mcdi_functions.c b/drivers/net/ethernet/sfc/mcdi_functions.c
>> index d3e6d8239f5c..4415f19cf68f 100644
>> --- a/drivers/net/ethernet/sfc/mcdi_functions.c
>> +++ b/drivers/net/ethernet/sfc/mcdi_functions.c
>> @@ -413,7 +413,8 @@ int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode)
>> return 0;
>> }
>>
>> -int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index)
>> +int efx_get_fn_info(struct efx_nic *efx, unsigned int *pf_index,
>> + unsigned int *vf_index)
>> {
>> MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN);
>> size_t outlen;
>> @@ -426,6 +427,10 @@ int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index)
>> if (outlen < sizeof(outbuf))
>> return -EIO;
>>
>> - *pf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_PF);
>> + if (pf_index)
>> + *pf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_PF);
>> +
>> + if (efx->type->is_vf && vf_index)
>> + *vf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_VF);
>> return 0;
>> }
>> diff --git a/drivers/net/ethernet/sfc/mcdi_functions.h b/drivers/net/ethernet/sfc/mcdi_functions.h
>> index b0e2f53a0d9b..76dc0a13463e 100644
>> --- a/drivers/net/ethernet/sfc/mcdi_functions.h
>> +++ b/drivers/net/ethernet/sfc/mcdi_functions.h
>> @@ -28,6 +28,7 @@ void efx_mcdi_rx_remove(struct efx_rx_queue *rx_queue);
>> void efx_mcdi_rx_fini(struct efx_rx_queue *rx_queue);
>> int efx_fini_dmaq(struct efx_nic *efx);
>> int efx_mcdi_window_mode_to_stride(struct efx_nic *efx, u8 vi_window_mode);
>> -int efx_get_pf_index(struct efx_nic *efx, unsigned int *pf_index);
>> +int efx_get_fn_info(struct efx_nic *efx, unsigned int *pf_index,
>> + unsigned int *vf_index);
>>
>> #endif
>> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
>> index 3dc9eae5a81d..1da71deac71c 100644
>> --- a/drivers/net/ethernet/sfc/net_driver.h
>> +++ b/drivers/net/ethernet/sfc/net_driver.h
>> @@ -1090,6 +1090,12 @@ struct efx_nic {
>> int rx_packet_len_offset;
>> int rx_packet_ts_offset;
>> bool rx_scatter;
>> +#ifdef CONFIG_SFC_VDPA
>> + /** @mgmt_dev: vDPA Management device */
>> + struct vdpa_mgmt_dev *mgmt_dev;
>> + /** @vdpa_nic: vDPA device structure (EF100) */
>> + struct ef100_vdpa_nic *vdpa_nic;
>> +#endif
>> struct efx_rss_context rss_context;
>> struct mutex rss_lock;
>> u32 vport_id;
>> --
>> 2.30.1

2023-03-13 17:05:48

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 08/14] sfc: implement vdpa vring config operations


On 3/8/23 22:36, Martin Habets wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 07, 2023 at 05:06:10PM +0530, Gautam Dawar wrote:
>> This patch implements the vDPA config operations related to
>> virtqueues or vrings. These include setting vring address,
>> getting vq state, operations to enable/disable a vq etc.
>> The resources required for vring operations eg. VI, interrupts etc.
>> are also allocated.
>>
>> Signed-off-by: Gautam Dawar <[email protected]>
>> ---
>> drivers/net/ethernet/sfc/ef100_vdpa.c | 46 +++-
>> drivers/net/ethernet/sfc/ef100_vdpa.h | 54 +++++
>> drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 275 ++++++++++++++++++++++
>> 3 files changed, 374 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> index 4c5a98c9d6c3..c66e5aef69ea 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>> @@ -14,6 +14,7 @@
>> #include "ef100_vdpa.h"
>> #include "mcdi_vdpa.h"
>> #include "mcdi_filters.h"
>> +#include "mcdi_functions.h"
>> #include "ef100_netdev.h"
>>
>> static struct virtio_device_id ef100_vdpa_id_table[] = {
>> @@ -47,12 +48,31 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data)
>> return rc;
>> }
>>
>> +static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int *allocated_vis)
>> +{
>> + /* The first VI is reserved for MCDI
>> + * 1 VI each for rx + tx ring
>> + */
>> + unsigned int max_vis = 1 + EF100_VDPA_MAX_QUEUES_PAIRS;
>> + unsigned int min_vis = 1 + 1;
>> + int rc;
>> +
>> + rc = efx_mcdi_alloc_vis(efx, min_vis, max_vis,
>> + NULL, allocated_vis);
>> + if (!rc)
>> + return rc;
>> + if (*allocated_vis < min_vis)
>> + return -ENOSPC;
>> + return 0;
>> +}
>> +
>> static void ef100_vdpa_delete(struct efx_nic *efx)
>> {
>> if (efx->vdpa_nic) {
>> /* replace with _vdpa_unregister_device later */
>> put_device(&efx->vdpa_nic->vdpa_dev.dev);
>> }
>> + efx_mcdi_free_vis(efx);
>> }
>>
>> void ef100_vdpa_fini(struct efx_probe_data *probe_data)
>> @@ -104,9 +124,19 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> {
>> struct ef100_nic_data *nic_data = efx->nic_data;
>> struct ef100_vdpa_nic *vdpa_nic;
>> + unsigned int allocated_vis;
>> int rc;
>> + u8 i;
>>
>> nic_data->vdpa_class = dev_type;
>> + rc = vdpa_allocate_vis(efx, &allocated_vis);
>> + if (rc) {
>> + pci_err(efx->pci_dev,
>> + "%s Alloc VIs failed for vf:%u error:%d\n",
>> + __func__, nic_data->vf_index, rc);
>> + return ERR_PTR(rc);
>> + }
>> +
>> vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
>> vdpa_dev, &efx->pci_dev->dev,
>> &ef100_vdpa_config_ops,
>> @@ -117,7 +147,8 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> "vDPA device allocation failed for vf: %u\n",
>> nic_data->vf_index);
>> nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
>> - return ERR_PTR(-ENOMEM);
>> + rc = -ENOMEM;
>> + goto err_alloc_vis_free;
>> }
>>
>> mutex_init(&vdpa_nic->lock);
>> @@ -125,11 +156,21 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
>> vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
>> vdpa_nic->efx = efx;
>> + vdpa_nic->max_queue_pairs = allocated_vis - 1;
>> vdpa_nic->pf_index = nic_data->pf_index;
>> vdpa_nic->vf_index = nic_data->vf_index;
>> vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
>> vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;
>>
>> + for (i = 0; i < (2 * vdpa_nic->max_queue_pairs); i++) {
>> + rc = ef100_vdpa_init_vring(vdpa_nic, i);
>> + if (rc) {
>> + pci_err(efx->pci_dev,
>> + "vring init idx: %u failed, rc: %d\n", i, rc);
>> + goto err_put_device;
>> + }
>> + }
>> +
>> rc = get_net_config(vdpa_nic);
>> if (rc)
>> goto err_put_device;
>> @@ -146,6 +187,9 @@ static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>> err_put_device:
>> /* put_device invokes ef100_vdpa_free */
>> put_device(&vdpa_nic->vdpa_dev.dev);
>> +
>> +err_alloc_vis_free:
>> + efx_mcdi_free_vis(efx);
>> return ERR_PTR(rc);
>> }
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> index dcf4a8156415..348ca8a7404b 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>> @@ -32,6 +32,21 @@
>> /* Alignment requirement of the Virtqueue */
>> #define EF100_VDPA_VQ_ALIGN 4096
>>
>> +/* Vring configuration definitions */
>> +#define EF100_VRING_ADDRESS_CONFIGURED 0x1
>> +#define EF100_VRING_SIZE_CONFIGURED 0x10
>> +#define EF100_VRING_READY_CONFIGURED 0x100
>> +#define EF100_VRING_CONFIGURED (EF100_VRING_ADDRESS_CONFIGURED | \
>> + EF100_VRING_SIZE_CONFIGURED | \
>> + EF100_VRING_READY_CONFIGURED)
>> +#define EF100_VRING_CREATED 0x1000
> I only see these defines used a bit masks. So why skip all the bits
> in stead of using 0x2, 0x4, 0x8 respectively?

There is no particular reason. I just re-used the macros and their
values from the out of tree driver. Will change the to 0x1, 0x2, 0x4 and
0x8 respectively.

Thanks

>
> Martin
>
>> +
>> +/* Maximum size of msix name */
>> +#define EF100_VDPA_MAX_MSIX_NAME_SIZE 256
>> +
>> +/* Default high IOVA for MCDI buffer */
>> +#define EF100_VDPA_IOVA_BASE_ADDR 0x20000000000
>> +
>> /**
>> * enum ef100_vdpa_nic_state - possible states for a vDPA NIC
>> *
>> @@ -57,6 +72,41 @@ enum ef100_vdpa_vq_type {
>> EF100_VDPA_VQ_NTYPES
>> };
>>
>> +/**
>> + * struct ef100_vdpa_vring_info - vDPA vring data structure
>> + *
>> + * @desc: Descriptor area address of the vring
>> + * @avail: Available area address of the vring
>> + * @used: Device area address of the vring
>> + * @size: Number of entries in the vring
>> + * @vring_state: bit map to track vring configuration
>> + * @last_avail_idx: last available index of the vring
>> + * @last_used_idx: last used index of the vring
>> + * @doorbell_offset: doorbell offset
>> + * @doorbell_offset_valid: true if @doorbell_offset is updated
>> + * @vring_type: type of vring created
>> + * @vring_ctx: vring context information
>> + * @msix_name: device name for vring irq handler
>> + * @irq: irq number for vring irq handler
>> + * @cb: callback for vring interrupts
>> + */
>> +struct ef100_vdpa_vring_info {
>> + dma_addr_t desc;
>> + dma_addr_t avail;
>> + dma_addr_t used;
>> + u32 size;
>> + u16 vring_state;
>> + u32 last_avail_idx;
>> + u32 last_used_idx;
>> + u32 doorbell_offset;
>> + bool doorbell_offset_valid;
>> + enum ef100_vdpa_vq_type vring_type;
>> + struct efx_vring_ctx *vring_ctx;
>> + char msix_name[EF100_VDPA_MAX_MSIX_NAME_SIZE];
>> + u32 irq;
>> + struct vdpa_callback cb;
>> +};
>> +
>> /**
>> * struct ef100_vdpa_nic - vDPA NIC data structure
>> *
>> @@ -70,6 +120,7 @@ enum ef100_vdpa_vq_type {
>> * @features: negotiated feature bits
>> * @max_queue_pairs: maximum number of queue pairs supported
>> * @net_config: virtio_net_config data
>> + * @vring: vring information of the vDPA device.
>> * @mac_address: mac address of interface associated with this vdpa device
>> * @mac_configured: true after MAC address is configured
>> * @cfg_cb: callback for config change
>> @@ -86,6 +137,7 @@ struct ef100_vdpa_nic {
>> u64 features;
>> u32 max_queue_pairs;
>> struct virtio_net_config net_config;
>> + struct ef100_vdpa_vring_info vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
>> u8 *mac_address;
>> bool mac_configured;
>> struct vdpa_callback cfg_cb;
>> @@ -95,6 +147,8 @@ int ef100_vdpa_init(struct efx_probe_data *probe_data);
>> void ef100_vdpa_fini(struct efx_probe_data *probe_data);
>> int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
>> void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
>> +void ef100_vdpa_irq_vectors_free(void *data);
>> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>>
>> static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic *vdpa_nic)
>> {
>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> index a2364ef9f492..0051c4c0e47c 100644
>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>> @@ -9,13 +9,270 @@
>>
>> #include <linux/vdpa.h>
>> #include "ef100_vdpa.h"
>> +#include "io.h"
>> #include "mcdi_vdpa.h"
>>
>> +/* Get the queue's function-local index of the associated VI
>> + * virtqueue number queue 0 is reserved for MCDI
>> + */
>> +#define EFX_GET_VI_INDEX(vq_num) (((vq_num) / 2) + 1)
>> +
>> static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
>> {
>> return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
>> }
>>
>> +void ef100_vdpa_irq_vectors_free(void *data)
>> +{
>> + pci_free_irq_vectors(data);
>> +}
>> +
>> +static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + struct efx_vring_ctx *vring_ctx;
>> + u32 vi_index;
>> +
>> + if (idx % 2) /* Even VQ for RX and odd for TX */
>> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_TYPE_NET_TXQ;
>> + else
>> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_TYPE_NET_RXQ;
>> + vi_index = EFX_GET_VI_INDEX(idx);
>> + vring_ctx = efx_vdpa_vring_init(vdpa_nic->efx, vi_index,
>> + vdpa_nic->vring[idx].vring_type);
>> + if (IS_ERR(vring_ctx))
>> + return PTR_ERR(vring_ctx);
>> +
>> + vdpa_nic->vring[idx].vring_ctx = vring_ctx;
>> + return 0;
>> +}
>> +
>> +static void delete_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + efx_vdpa_vring_fini(vdpa_nic->vring[idx].vring_ctx);
>> + vdpa_nic->vring[idx].vring_ctx = NULL;
>> +}
>> +
>> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>> + vdpa_nic->vring[idx].vring_state = 0;
>> + vdpa_nic->vring[idx].last_avail_idx = 0;
>> + vdpa_nic->vring[idx].last_used_idx = 0;
>> +}
>> +
>> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>> +{
>> + u32 offset;
>> + int rc;
>> +
>> + vdpa_nic->vring[idx].irq = -EINVAL;
>> + rc = create_vring_ctx(vdpa_nic, idx);
>> + if (rc) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: create_vring_ctx failed, idx:%u, err:%d\n",
>> + __func__, idx, rc);
>> + return rc;
>> + }
>> +
>> + rc = efx_vdpa_get_doorbell_offset(vdpa_nic->vring[idx].vring_ctx,
>> + &offset);
>> + if (rc) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: get_doorbell failed idx:%u, err:%d\n",
>> + __func__, idx, rc);
>> + goto err_get_doorbell_offset;
>> + }
>> + vdpa_nic->vring[idx].doorbell_offset = offset;
>> + vdpa_nic->vring[idx].doorbell_offset_valid = true;
>> +
>> + return 0;
>> +
>> +err_get_doorbell_offset:
>> + delete_vring_ctx(vdpa_nic, idx);
>> + return rc;
>> +}
>> +
>> +static bool is_qid_invalid(struct ef100_vdpa_nic *vdpa_nic, u16 idx,
>> + const char *caller)
>> +{
>> + if (unlikely(idx >= (vdpa_nic->max_queue_pairs * 2))) {
>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>> + "%s: Invalid qid %u\n", caller, idx);
>> + return true;
>> + }
>> + return false;
>> +}
>> +
>> +static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
>> + u16 idx, u64 desc_area, u64 driver_area,
>> + u64 device_area)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return -EINVAL;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + vdpa_nic->vring[idx].desc = desc_area;
>> + vdpa_nic->vring[idx].avail = driver_area;
>> + vdpa_nic->vring[idx].used = device_area;
>> + vdpa_nic->vring[idx].vring_state |= EF100_VRING_ADDRESS_CONFIGURED;
>> + mutex_unlock(&vdpa_nic->lock);
>> + return 0;
>> +}
>> +
>> +static void ef100_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return;
>> +
>> + if (!is_power_of_2(num)) {
>> + dev_err(&vdev->dev, "%s: Index:%u size:%u not power of 2\n",
>> + __func__, idx, num);
>> + return;
>> + }
>> + if (num > EF100_VDPA_VQ_NUM_MAX_SIZE) {
>> + dev_err(&vdev->dev, "%s: Index:%u size:%u more than max:%u\n",
>> + __func__, idx, num, EF100_VDPA_VQ_NUM_MAX_SIZE);
>> + return;
>> + }
>> + mutex_lock(&vdpa_nic->lock);
>> + vdpa_nic->vring[idx].size = num;
>> + vdpa_nic->vring[idx].vring_state |= EF100_VRING_SIZE_CONFIGURED;
>> + mutex_unlock(&vdpa_nic->lock);
>> +}
>> +
>> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + u32 idx_val;
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return;
>> +
>> + if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>> + return;
>> +
>> + idx_val = idx;
>> + _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>> + vdpa_nic->vring[idx].doorbell_offset);
>> +}
>> +
>> +static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
>> + struct vdpa_callback *cb)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return;
>> +
>> + if (cb)
>> + vdpa_nic->vring[idx].cb = *cb;
>> +}
>> +
>> +static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
>> + bool ready)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + if (ready) {
>> + vdpa_nic->vring[idx].vring_state |=
>> + EF100_VRING_READY_CONFIGURED;
>> + } else {
>> + vdpa_nic->vring[idx].vring_state &=
>> + ~EF100_VRING_READY_CONFIGURED;
>> + }
>> + mutex_unlock(&vdpa_nic->lock);
>> +}
>> +
>> +static bool ef100_vdpa_get_vq_ready(struct vdpa_device *vdev, u16 idx)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + bool ready;
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return false;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + ready = vdpa_nic->vring[idx].vring_state & EF100_VRING_READY_CONFIGURED;
>> + mutex_unlock(&vdpa_nic->lock);
>> + return ready;
>> +}
>> +
>> +static int ef100_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx,
>> + const struct vdpa_vq_state *state)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return -EINVAL;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + vdpa_nic->vring[idx].last_avail_idx = state->split.avail_index;
>> + vdpa_nic->vring[idx].last_used_idx = state->split.avail_index;
>> + mutex_unlock(&vdpa_nic->lock);
>> + return 0;
>> +}
>> +
>> +static int ef100_vdpa_get_vq_state(struct vdpa_device *vdev,
>> + u16 idx, struct vdpa_vq_state *state)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return -EINVAL;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + state->split.avail_index = (u16)vdpa_nic->vring[idx].last_used_idx;
>> + mutex_unlock(&vdpa_nic->lock);
>> +
>> + return 0;
>> +}
>> +
>> +static struct vdpa_notification_area
>> + ef100_vdpa_get_vq_notification(struct vdpa_device *vdev,
>> + u16 idx)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + struct vdpa_notification_area notify_area = {0, 0};
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + goto end;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + notify_area.addr = (uintptr_t)(vdpa_nic->efx->membase_phys +
>> + vdpa_nic->vring[idx].doorbell_offset);
>> + /* VDPA doorbells are at a stride of VI/2
>> + * One VI stride is shared by both rx & tx doorbells
>> + */
>> + notify_area.size = vdpa_nic->efx->vi_stride / 2;
>> + mutex_unlock(&vdpa_nic->lock);
>> +
>> +end:
>> + return notify_area;
>> +}
>> +
>> +static int ef100_get_vq_irq(struct vdpa_device *vdev, u16 idx)
>> +{
>> + struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + u32 irq;
>> +
>> + if (is_qid_invalid(vdpa_nic, idx, __func__))
>> + return -EINVAL;
>> +
>> + mutex_lock(&vdpa_nic->lock);
>> + irq = vdpa_nic->vring[idx].irq;
>> + mutex_unlock(&vdpa_nic->lock);
>> +
>> + return irq;
>> +}
>> +
>> static u32 ef100_vdpa_get_vq_align(struct vdpa_device *vdev)
>> {
>> return EF100_VDPA_VQ_ALIGN;
>> @@ -80,6 +337,8 @@ static void ef100_vdpa_set_config_cb(struct vdpa_device *vdev,
>>
>> if (cb)
>> vdpa_nic->cfg_cb = *cb;
>> + else
>> + memset(&vdpa_nic->cfg_cb, 0, sizeof(vdpa_nic->cfg_cb));
>> }
>>
>> static u16 ef100_vdpa_get_vq_num_max(struct vdpa_device *vdev)
>> @@ -137,14 +396,30 @@ static void ef100_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset,
>> static void ef100_vdpa_free(struct vdpa_device *vdev)
>> {
>> struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>> + int i;
>>
>> if (vdpa_nic) {
>> + for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>> + reset_vring(vdpa_nic, i);
>> + if (vdpa_nic->vring[i].vring_ctx)
>> + delete_vring_ctx(vdpa_nic, i);
>> + }
>> mutex_destroy(&vdpa_nic->lock);
>> vdpa_nic->efx->vdpa_nic = NULL;
>> }
>> }
>>
>> const struct vdpa_config_ops ef100_vdpa_config_ops = {
>> + .set_vq_address = ef100_vdpa_set_vq_address,
>> + .set_vq_num = ef100_vdpa_set_vq_num,
>> + .kick_vq = ef100_vdpa_kick_vq,
>> + .set_vq_cb = ef100_vdpa_set_vq_cb,
>> + .set_vq_ready = ef100_vdpa_set_vq_ready,
>> + .get_vq_ready = ef100_vdpa_get_vq_ready,
>> + .set_vq_state = ef100_vdpa_set_vq_state,
>> + .get_vq_state = ef100_vdpa_get_vq_state,
>> + .get_vq_notification = ef100_vdpa_get_vq_notification,
>> + .get_vq_irq = ef100_get_vq_irq,
>> .get_vq_align = ef100_vdpa_get_vq_align,
>> .get_device_features = ef100_vdpa_get_device_features,
>> .set_driver_features = ef100_vdpa_set_driver_features,
>> --
>> 2.30.1

2023-03-13 17:22:04

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 11/14] sfc: use PF's IOMMU domain for running VF's MCDI commands


On 3/8/23 23:31, Martin Habets wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Mar 07, 2023 at 05:06:13PM +0530, Gautam Dawar wrote:
>> This changeset uses MC_CMD_CLIENT_CMD to execute VF's MCDI
>> commands when running in vDPA mode (STATE_VDPA).
>> Also, use the PF's IOMMU domain for executing the encapsulated
>> VF's MCDI commands to isolate DMA of guest buffers in the VF's
>> IOMMU domain.
>> This patch also updates the PCIe FN's client id in the efx_nic
>> structure which is required while running MC_CMD_CLIENT_CMD.
>>
>> Signed-off-by: Gautam Dawar <[email protected]>
>> ---
>> drivers/net/ethernet/sfc/ef100.c | 1 +
>> drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++
>> drivers/net/ethernet/sfc/mcdi.c | 108 ++++++++++++++++++++++----
>> drivers/net/ethernet/sfc/mcdi.h | 2 +-
>> drivers/net/ethernet/sfc/net_driver.h | 2 +
>> drivers/net/ethernet/sfc/ptp.c | 4 +-
>> 6 files changed, 132 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
>> index c1c69783db7b..8453c9ba0f41 100644
>> --- a/drivers/net/ethernet/sfc/ef100.c
>> +++ b/drivers/net/ethernet/sfc/ef100.c
>> @@ -465,6 +465,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
>> efx->type = (const struct efx_nic_type *)entry->driver_data;
>>
>> efx->pci_dev = pci_dev;
>> + efx->client_id = MC_CMD_CLIENT_ID_SELF;
>> pci_set_drvdata(pci_dev, efx);
>> rc = efx_init_struct(efx, pci_dev);
>> if (rc)
>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
>> index bda4fcbe1126..cd9f724a9e64 100644
>> --- a/drivers/net/ethernet/sfc/ef100_nic.c
>> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
>> @@ -206,9 +206,11 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
>> "firmware reports num_mac_stats = %u\n",
>> efx->num_mac_stats);
>>
>> +#ifdef CONFIG_SFC_VDPA
> More opportunities to use IS_ENABLED(CONFIG_SFC_VDPA) in this patch
> in stead of the #ifdef.

Will fix the occurrence where nic_data->vdpa_supported is being updated.
However, I am not sure if using something like:

if (IS_ENABLED(CONFIG_SFC_VDPA) && (new_config == EF100_BAR_CONFIG_VDPA
&& !nic_data->vdpa_supported))

to replace

#ifdef CONFIG_SFC_VDPA
        if (new_config == EF100_BAR_CONFIG_VDPA &&
!nic_data->vdpa_supported) {

would be correct as vdpa_supported itself is conditionally defined:

struct ef100_nic_data {

...

#ifdef CONFIG_SFC_VDPA
        bool vdpa_supported; /* true if vdpa is supported on this PCIe
FN */
 ...

}

Another way would be to use nested if statements but not sure if it is
really needed.

Thanks

>
> Martin
>
>> nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
>> CLIENT_CMD_VF_PROXY) &&
>> efx->type->is_vf;
>> +#endif
>> return 0;
>> }
>>
>> @@ -1086,6 +1088,35 @@ static int ef100_check_design_params(struct efx_nic *efx)
>> return rc;
>> }
>>
>> +static int efx_ef100_update_client_id(struct efx_nic *efx)
>> +{
>> + struct ef100_nic_data *nic_data = efx->nic_data;
>> + unsigned int pf_index = PCIE_FUNCTION_PF_NULL;
>> + unsigned int vf_index = PCIE_FUNCTION_VF_NULL;
>> + efx_qword_t pciefn;
>> + int rc;
>> +
>> + if (efx->pci_dev->is_virtfn)
>> + vf_index = nic_data->vf_index;
>> + else
>> + pf_index = nic_data->pf_index;
>> +
>> + /* Construct PCIE_FUNCTION structure */
>> + EFX_POPULATE_QWORD_3(pciefn,
>> + PCIE_FUNCTION_PF, pf_index,
>> + PCIE_FUNCTION_VF, vf_index,
>> + PCIE_FUNCTION_INTF, PCIE_INTERFACE_CALLER);
>> + /* look up self client ID */
>> + rc = efx_ef100_lookup_client_id(efx, pciefn, &efx->client_id);
>> + if (rc) {
>> + pci_warn(efx->pci_dev,
>> + "%s: Failed to get client ID, rc %d\n",
>> + __func__, rc);
>> + }
>> +
>> + return rc;
>> +}
>> +
>> /* NIC probe and remove
>> */
>> static int ef100_probe_main(struct efx_nic *efx)
>> @@ -1173,6 +1204,10 @@ static int ef100_probe_main(struct efx_nic *efx)
>> goto fail;
>> efx->port_num = rc;
>>
>> + rc = efx_ef100_update_client_id(efx);
>> + if (rc)
>> + goto fail;
>> +
>> efx_mcdi_print_fwver(efx, fw_version, sizeof(fw_version));
>> pci_dbg(efx->pci_dev, "Firmware version %s\n", fw_version);
>>
>> diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
>> index a7f2c31071e8..3bf1ebe05775 100644
>> --- a/drivers/net/ethernet/sfc/mcdi.c
>> +++ b/drivers/net/ethernet/sfc/mcdi.c
>> @@ -145,14 +145,15 @@ void efx_mcdi_fini(struct efx_nic *efx)
>> kfree(efx->mcdi);
>> }
>>
>> -static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
>> - const efx_dword_t *inbuf, size_t inlen)
>> +static void efx_mcdi_send_request(struct efx_nic *efx, u32 client_id,
>> + unsigned int cmd, const efx_dword_t *inbuf,
>> + size_t inlen)
>> {
>> struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
>> #ifdef CONFIG_SFC_MCDI_LOGGING
>> char *buf = mcdi->logging_buffer; /* page-sized */
>> #endif
>> - efx_dword_t hdr[2];
>> + efx_dword_t hdr[5];
>> size_t hdr_len;
>> u32 xflags, seqno;
>>
>> @@ -179,7 +180,7 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
>> MCDI_HEADER_XFLAGS, xflags,
>> MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
>> hdr_len = 4;
>> - } else {
>> + } else if (client_id == efx->client_id) {
>> /* MCDI v2 */
>> BUG_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
>> EFX_POPULATE_DWORD_7(hdr[0],
>> @@ -194,6 +195,35 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
>> MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
>> MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
>> hdr_len = 8;
>> + } else {
>> + /* MCDI v2 */
>> + WARN_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
>> + /* MCDI v2 with credentials of a different client */
>> + BUILD_BUG_ON(MC_CMD_CLIENT_CMD_IN_LEN != 4);
>> + /* Outer CLIENT_CMD wrapper command with client ID */
>> + EFX_POPULATE_DWORD_7(hdr[0],
>> + MCDI_HEADER_RESPONSE, 0,
>> + MCDI_HEADER_RESYNC, 1,
>> + MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
>> + MCDI_HEADER_DATALEN, 0,
>> + MCDI_HEADER_SEQ, seqno,
>> + MCDI_HEADER_XFLAGS, xflags,
>> + MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
>> + EFX_POPULATE_DWORD_2(hdr[1],
>> + MC_CMD_V2_EXTN_IN_EXTENDED_CMD,
>> + MC_CMD_CLIENT_CMD,
>> + MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen + 12);
>> + MCDI_SET_DWORD(&hdr[2],
>> + CLIENT_CMD_IN_CLIENT_ID, client_id);
>> +
>> + /* MCDIv2 header for inner command */
>> + EFX_POPULATE_DWORD_2(hdr[3],
>> + MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
>> + MCDI_HEADER_DATALEN, 0);
>> + EFX_POPULATE_DWORD_2(hdr[4],
>> + MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
>> + MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
>> + hdr_len = 20;
>> }
>>
>> #ifdef CONFIG_SFC_MCDI_LOGGING
>> @@ -474,7 +504,8 @@ static void efx_mcdi_release(struct efx_mcdi_iface *mcdi)
>> &mcdi->async_list, struct efx_mcdi_async_param, list);
>> if (async) {
>> mcdi->state = MCDI_STATE_RUNNING_ASYNC;
>> - efx_mcdi_send_request(efx, async->cmd,
>> + efx_mcdi_send_request(efx, efx->client_id,
>> + async->cmd,
>> (const efx_dword_t *)(async + 1),
>> async->inlen);
>> mod_timer(&mcdi->async_timer,
>> @@ -797,7 +828,7 @@ static int efx_mcdi_proxy_wait(struct efx_nic *efx, u32 handle, bool quiet)
>> return mcdi->proxy_rx_status;
>> }
>>
>> -static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
>> +static int _efx_mcdi_rpc(struct efx_nic *efx, u32 client_id, unsigned int cmd,
>> const efx_dword_t *inbuf, size_t inlen,
>> efx_dword_t *outbuf, size_t outlen,
>> size_t *outlen_actual, bool quiet, int *raw_rc)
>> @@ -811,7 +842,7 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
>> return -EINVAL;
>> }
>>
>> - rc = efx_mcdi_rpc_start(efx, cmd, inbuf, inlen);
>> + rc = efx_mcdi_rpc_start(efx, client_id, cmd, inbuf, inlen);
>> if (rc)
>> return rc;
>>
>> @@ -836,7 +867,8 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
>>
>> /* We now retry the original request. */
>> mcdi->state = MCDI_STATE_RUNNING_SYNC;
>> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
>> + efx_mcdi_send_request(efx, efx->client_id, cmd,
>> + inbuf, inlen);
>>
>> rc = _efx_mcdi_rpc_finish(efx, cmd, inlen,
>> outbuf, outlen, outlen_actual,
>> @@ -855,16 +887,44 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
>> return rc;
>> }
>>
>> +#ifdef CONFIG_SFC_VDPA
>> +static bool is_mode_vdpa(struct efx_nic *efx)
>> +{
>> + if (efx->pci_dev->is_virtfn &&
>> + efx->pci_dev->physfn &&
>> + efx->state == STATE_VDPA &&
>> + efx->vdpa_nic)
>> + return true;
>> +
>> + return false;
>> +}
>> +#endif
>> +
>> static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
>> const efx_dword_t *inbuf, size_t inlen,
>> efx_dword_t *outbuf, size_t outlen,
>> size_t *outlen_actual, bool quiet)
>> {
>> +#ifdef CONFIG_SFC_VDPA
>> + struct efx_nic *efx_pf;
>> +#endif
>> int raw_rc = 0;
>> int rc;
>>
>> - rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
>> - outbuf, outlen, outlen_actual, true, &raw_rc);
>> +#ifdef CONFIG_SFC_VDPA
>> + if (is_mode_vdpa(efx)) {
>> + efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
>> + rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd, inbuf,
>> + inlen, outbuf, outlen, outlen_actual,
>> + true, &raw_rc);
>> + } else {
>> +#endif
>> + rc = _efx_mcdi_rpc(efx, efx->client_id, cmd, inbuf,
>> + inlen, outbuf, outlen, outlen_actual, true,
>> + &raw_rc);
>> +#ifdef CONFIG_SFC_VDPA
>> + }
>> +#endif
>>
>> if ((rc == -EPROTO) && (raw_rc == MC_CMD_ERR_NO_EVB_PORT) &&
>> efx->type->is_vf) {
>> @@ -881,9 +941,22 @@ static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
>>
>> do {
>> usleep_range(delay_us, delay_us + 10000);
>> - rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
>> - outbuf, outlen, outlen_actual,
>> - true, &raw_rc);
>> +#ifdef CONFIG_SFC_VDPA
>> + if (is_mode_vdpa(efx)) {
>> + efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
>> + rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd,
>> + inbuf, inlen, outbuf, outlen,
>> + outlen_actual, true,
>> + &raw_rc);
>> + } else {
>> +#endif
>> + rc = _efx_mcdi_rpc(efx, efx->client_id,
>> + cmd, inbuf, inlen, outbuf,
>> + outlen, outlen_actual, true,
>> + &raw_rc);
>> +#ifdef CONFIG_SFC_VDPA
>> + }
>> +#endif
>> if (delay_us < 100000)
>> delay_us <<= 1;
>> } while ((rc == -EPROTO) &&
>> @@ -939,7 +1012,7 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
>> * function and is then responsible for calling efx_mcdi_display_error
>> * as needed.
>> */
>> -int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
>> +int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned int cmd,
>> const efx_dword_t *inbuf, size_t inlen,
>> efx_dword_t *outbuf, size_t outlen,
>> size_t *outlen_actual)
>> @@ -948,7 +1021,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
>> outlen_actual, true);
>> }
>>
>> -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
>> +int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
>> const efx_dword_t *inbuf, size_t inlen)
>> {
>> struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
>> @@ -965,7 +1038,7 @@ int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
>> return -ENETDOWN;
>>
>> efx_mcdi_acquire_sync(mcdi);
>> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
>> + efx_mcdi_send_request(efx, client_id, cmd, inbuf, inlen);
>> return 0;
>> }
>>
>> @@ -1009,7 +1082,8 @@ static int _efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd,
>> */
>> if (mcdi->async_list.next == &async->list &&
>> efx_mcdi_acquire_async(mcdi)) {
>> - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
>> + efx_mcdi_send_request(efx, efx->client_id,
>> + cmd, inbuf, inlen);
>> mod_timer(&mcdi->async_timer,
>> jiffies + MCDI_RPC_TIMEOUT);
>> }
>> diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
>> index dafab52aaef7..2c526d2edeb6 100644
>> --- a/drivers/net/ethernet/sfc/mcdi.h
>> +++ b/drivers/net/ethernet/sfc/mcdi.h
>> @@ -150,7 +150,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
>> efx_dword_t *outbuf, size_t outlen,
>> size_t *outlen_actual);
>>
>> -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
>> +int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
>> const efx_dword_t *inbuf, size_t inlen);
>> int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
>> efx_dword_t *outbuf, size_t outlen,
>> diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
>> index 1da71deac71c..948c7a06403a 100644
>> --- a/drivers/net/ethernet/sfc/net_driver.h
>> +++ b/drivers/net/ethernet/sfc/net_driver.h
>> @@ -859,6 +859,7 @@ struct efx_mae;
>> * @secondary_list: List of &struct efx_nic instances for the secondary PCI
>> * functions of the controller, if this is for the primary function.
>> * Serialised by rtnl_lock.
>> + * @client_id: client ID of this PCIe function
>> * @type: Controller type attributes
>> * @legacy_irq: IRQ number
>> * @workqueue: Workqueue for port reconfigures and the HW monitor.
>> @@ -1022,6 +1023,7 @@ struct efx_nic {
>> struct list_head secondary_list;
>> struct pci_dev *pci_dev;
>> unsigned int port_num;
>> + u32 client_id;
>> const struct efx_nic_type *type;
>> int legacy_irq;
>> bool eeh_disabled_legacy_irq;
>> diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
>> index 9f07e1ba7780..d90d4f6b3824 100644
>> --- a/drivers/net/ethernet/sfc/ptp.c
>> +++ b/drivers/net/ethernet/sfc/ptp.c
>> @@ -1052,8 +1052,8 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
>>
>> /* Clear flag that signals MC ready */
>> WRITE_ONCE(*start, 0);
>> - rc = efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf,
>> - MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
>> + rc = efx_mcdi_rpc_start(efx, MC_CMD_CLIENT_ID_SELF, MC_CMD_PTP,
>> + synch_buf, MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
>> EFX_WARN_ON_ONCE_PARANOID(rc);
>>
>> /* Wait for start from MCDI (or timeout) */
>> --
>> 2.30.1

2023-03-14 08:33:04

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 03/14] sfc: update MCDI headers for CLIENT_CMD_VF_PROXY capability bit

On Mon, Mar 13, 2023 at 08:08:14PM +0530, Gautam Dawar wrote:
>
> On 3/8/23 21:45, Martin Habets wrote:
> > Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> >
> >
> > On Tue, Mar 07, 2023 at 12:12:15PM +0000, Lucero Palau, Alejandro wrote:
> > > On 3/7/23 11:36, Gautam Dawar wrote:
> > > > vDPA requires the ability to proxy MCDI commands from a PF to a VF
> > > > there by using PF's IOMMU domain for executing vDPA VF's MCDI commands
> > > > ensuring isolation from the DMA domain used by guest buffers.
> > > > A new capability bit CLIENT_CMD_VF_PROXY has been added to Firmware,
> > > > which when exposed, suggests that Firmware supports MC_CMD_CLIENT_CMD
> > > > to VFs and hence supports vDPA requirement.
> > > > mcdi_pcol.h is a tool generated file and hence may not be free from
> > > > all checks and/or warnings when tested with checkpatch.pl script.
> > > >
> > > > Signed-off-by: Gautam Dawar <[email protected]>
> > > > ---
> > > > drivers/net/ethernet/sfc/mcdi_pcol.h | 4390 +++++++++++++++++++++++++-
> > > > drivers/net/ethernet/sfc/mcdi_vdpa.c | 10 +-
> > > > 2 files changed, 4288 insertions(+), 112 deletions(-)
> > > >
> > > > diff --git a/drivers/net/ethernet/sfc/mcdi_pcol.h b/drivers/net/ethernet/sfc/mcdi_pcol.h
> > > > index cd297e19cddc..bdb6a53b8be3 100644
> > > > --- a/drivers/net/ethernet/sfc/mcdi_pcol.h
> > > > +++ b/drivers/net/ethernet/sfc/mcdi_pcol.h
> > > > @@ -2,10 +2,9 @@
> > > > /****************************************************************************
> > > > * Driver for Solarflare network controllers and boards
> > > > * Copyright 2009-2018 Solarflare Communications Inc.
> > > > - * Copyright 2019-2020 Xilinx Inc.
> > > > + * Copyright 2019-2022 Xilinx Inc.
> > > > */
> > > >
> > > 2023?
>
> I can do that unless manual changes to this file are prohibited.
>
> Martin?

We can change the code that generates this file, we'll discuss the procedure
offline.

>
> > >
> > > > -
> > > > #ifndef MCDI_PCOL_H
> > > > #define MCDI_PCOL_H
> > > >
> > > > @@ -72,19 +71,19 @@
> > > > * | \------- Error
> > > > * \------------------------------ Resync (always set)
> > > > *
> > > > - * The client writes it's request into MC shared memory, and rings the
> > > > - * doorbell. Each request is completed by either by the MC writing
> > > > + * The client writes its request into MC shared memory, and rings the
> > > > + * doorbell. Each request is completed either by the MC writing
> > > It seems this patch has been also seized for fixing a good number of typos.
> > > I would not mind if one or two go into, but that is not the case here.
> > > All those fixes should be in another patch out of this patchset.
> > As stated in the description, mcdi_pcol.h is a generated file. We cannot
> > pick and choose what parts to pick up, we always have to use the latest
> > version that contains the changes we need.
> >
> > Martin
> +1
> >
> > > > * back into shared memory, or by writing out an event.
> > > > *
> > > > * All MCDI commands support completion by shared memory response. Each
> > > > * request may also contain additional data (accounted for by HEADER.LEN),
> > > > - * and some response's may also contain additional data (again, accounted
> > > > + * and some responses may also contain additional data (again, accounted
> > > > * for by HEADER.LEN).
> > > > *
> > > > * Some MCDI commands support completion by event, in which any associated
> > > > * response data is included in the event.
> > > > *
> > > > - * The protocol requires one response to be delivered for every request, a
> > > > + * The protocol requires one response to be delivered for every request; a
> > > > * request should not be sent unless the response for the previous request
> > > > * has been received (either by polling shared memory, or by receiving
> > > > * an event).
> > > > @@ -121,7 +120,6 @@
> > > >
> > > > #define MCDI_CTL_SDU_LEN_MAX MCDI_CTL_SDU_LEN_MAX_V2
> > > >
> > > > -
> > > > /* The MC can generate events for two reasons:
> > > > * - To advance a shared memory request if XFLAGS_EVREQ was set
> > > > * - As a notification (link state, i2c event), controlled
> > > > @@ -165,6 +163,7 @@
> > > > #define FSE_AZ_EV_CODE_MCDI_EVRESPONSE 0xc
> > > >
> > > >
> > > > +
> > > > #define MC_CMD_ERR_CODE_OFST 0
> > > > #define MC_CMD_ERR_PROXY_PENDING_HANDLE_OFST 4
> > > >
> > > > @@ -228,7 +227,6 @@
> > > > */
> > > > #define EVB_STACK_ID(n) (((n) & 0xff) << 16)
> > > >
> > > > -
> > > > /* Version 2 adds an optional argument to error returns: the errno value
> > > > * may be followed by the (0-based) number of the first argument that
> > > > * could not be processed.
> > > > @@ -321,7 +319,7 @@
> > > > /* enum: The requesting client is not a function */
> > > > #define MC_CMD_ERR_CLIENT_NOT_FN 0x100c
> > > > /* enum: The requested operation might require the command to be passed between
> > > > - * MCs, and thetransport doesn't support that. Should only ever been seen over
> > > > + * MCs, and the transport doesn't support that. Should only ever been seen over
> > > > * the UART.
> > > > */
> > > > #define MC_CMD_ERR_TRANSPORT_NOPROXY 0x100d
> > > > @@ -358,7 +356,7 @@
> > > > * sub-variant switching.
> > > > */
> > > > #define MC_CMD_ERR_FILTERS_PRESENT 0x1014
> > > > -/* enum: The clock whose frequency you've attempted to set set doesn't exist on
> > > > +/* enum: The clock whose frequency you've attempted to set doesn't exist on
> > > > * this NIC
> > > > */
> > > > #define MC_CMD_ERR_NO_CLOCK 0x1015
> > > > @@ -640,7 +638,11 @@
> > > > * be allocated by different counter blocks, so e.g. AR counter 42 is different
> > > > * from CT counter 42. Generation counts are also type-specific. This value is
> > > > * also present in the header of streaming counter packets, in the IDENTIFIER
> > > > - * field (see packetiser packet format definitions).
> > > > + * field (see packetiser packet format definitions). Also note that LACP
> > > > + * counter IDs are not allocated individually, instead the counter IDs are
> > > > + * directly tied to the LACP balance table indices. These in turn are allocated
> > > > + * in large contiguous blocks as a LAG config. Calling MAE_COUNTER_ALLOC/FREE
> > > > + * with an LACP counter type will return EPERM.
> > > > */
> > > > /* enum: Action Rule counters - can be referenced in AR response. */
> > > > #define MAE_COUNTER_TYPE_AR 0x0
> > > > @@ -648,6 +650,14 @@
> > > > #define MAE_COUNTER_TYPE_CT 0x1
> > > > /* enum: Outer Rule counters - can be referenced in OR response. */
> > > > #define MAE_COUNTER_TYPE_OR 0x2
> > > > +/* enum: LACP counters - linked to LACP balance table entries. */
> > > > +#define MAE_COUNTER_TYPE_LACP 0x3
> > > > +
> > > > +/* MAE_COUNTER_ID enum: ID of allocated counter or counter list. */
> > > > +/* enum: A counter ID that is guaranteed never to represent a real counter or
> > > > + * counter list.
> > > > + */
> > > > +#define MAE_COUNTER_ID_NULL 0xffffffff
> > > >
> > > > /* TABLE_ID enum: Unique IDs for tables. The 32-bit ID values have been
> > > > * structured with bits [31:24] reserved (0), [23:16] indicating which major
> > > > @@ -656,7 +666,9 @@
> > > > * variations of the same table. (All of the tables currently defined within
> > > > * the streaming engines are listed here, but this does not imply that they are
> > > > * all supported - MC_CMD_TABLE_LIST returns the list of actually supported
> > > > - * tables.)
> > > > + * tables.) The DPU offload engines' enumerators follow a deliberate pattern:
> > > > + * 0x01010000 + is_dpu_net * 0x10000 + is_wr_or_tx * 0x8000 + is_lite_pipe *
> > > > + * 0x1000 + oe_engine_type * 0x100 + oe_instance_within_pipe * 0x10
> > > > */
> > > > /* enum: Outer_Rule_Table in the MAE - refer to SF-123102-TC. */
> > > > #define TABLE_ID_OUTER_RULE_TABLE 0x10000
> > > > @@ -694,6 +706,70 @@
> > > > #define TABLE_ID_RSS_CONTEXT_TABLE 0x20200
> > > > /* enum: Indirection_Table in VNIC Rx - refer to SF-123102-TC. */
> > > > #define TABLE_ID_INDIRECTION_TABLE 0x20300
> > > > +/* enum: DPU.host read pipe first CRC offload engine profiles - refer to
> > > > + * XN-200147-AN.
> > > I think this is an internal document not available to the public.
> > > Please, remove all those references.
>
> Again, not sure if any manual changes are allowed to this file. IIUC, we
> simply replace this file with the newer version generated by the tool
> whenever any new changes are added.

Agree

Martin

> Thanks
>
> > >
> > > > + */
> > > > +#define TABLE_ID_DPU_HOST_RD_CRC0_OE_PROFILE 0x1010000
> > > > +/* enum: DPU.host read pipe second CRC offload engine profiles - refer to
> > > > + * XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_HOST_RD_CRC1_OE_PROFILE 0x1010010
> > > > +/* enum: DPU.host write pipe first CRC offload engine profiles - refer to
> > > > + * XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_HOST_WR_CRC0_OE_PROFILE 0x1018000
> > > > +/* enum: DPU.host write pipe second CRC offload engine profiles - refer to
> > > > + * XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_HOST_WR_CRC1_OE_PROFILE 0x1018010
> > > > +/* enum: DPU.net 'full' receive pipe CRC offload engine profiles - refer to
> > > > + * XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_RX_CRC0_OE_PROFILE 0x1020000
> > > > +/* enum: DPU.net 'full' receive pipe first checksum offload engine profiles -
> > > > + * refer to XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_RX_CSUM0_OE_PROFILE 0x1020100
> > > > +/* enum: DPU.net 'full' receive pipe second checksum offload engine profiles -
> > > > + * refer to XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_RX_CSUM1_OE_PROFILE 0x1020110
> > > > +/* enum: DPU.net 'full' receive pipe AES-GCM offload engine profiles - refer to
> > > > + * XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_RX_AES_GCM0_OE_PROFILE 0x1020200
> > > > +/* enum: DPU.net 'lite' receive pipe CRC offload engine profiles - refer to
> > > > + * XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_RXLITE_CRC0_OE_PROFILE 0x1021000
> > > > +/* enum: DPU.net 'lite' receive pipe checksum offload engine profiles - refer
> > > > + * to XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_RXLITE_CSUM0_OE_PROFILE 0x1021100
> > > > +/* enum: DPU.net 'full' transmit pipe CRC offload engine profiles - refer to
> > > > + * XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_TX_CRC0_OE_PROFILE 0x1028000
> > > > +/* enum: DPU.net 'full' transmit pipe first checksum offload engine profiles -
> > > > + * refer to XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_TX_CSUM0_OE_PROFILE 0x1028100
> > > > +/* enum: DPU.net 'full' transmit pipe second checksum offload engine profiles -
> > > > + * refer to XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_TX_CSUM1_OE_PROFILE 0x1028110
> > > > +/* enum: DPU.net 'full' transmit pipe AES-GCM offload engine profiles - refer
> > > > + * to XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_TX_AES_GCM0_OE_PROFILE 0x1028200
> > > > +/* enum: DPU.net 'lite' transmit pipe CRC offload engine profiles - refer to
> > > > + * XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_TXLITE_CRC0_OE_PROFILE 0x1029000
> > > > +/* enum: DPU.net 'lite' transmit pipe checksum offload engine profiles - refer
> > > > + * to XN-200147-AN.
> > > > + */
> > > > +#define TABLE_ID_DPU_NET_TXLITE_CSUM0_OE_PROFILE 0x1029100
> > > >
> > > > /* TABLE_COMPRESSED_VLAN enum: Compressed VLAN TPID as used by some field
> > > > * types; can be calculated by (((ether_type_msb >> 2) & 0x4) ^ 0x4) |
> > > > @@ -734,6 +810,42 @@
> > > > /* enum: RSS uses even spreading calculation. */
> > > > #define TABLE_RSS_SPREAD_MODE_EVEN 0x1
> > > >
> > > > +/* CRC_VARIANT enum: Operation for the DPU CRC engine to perform. */
> > > > +/* enum: Calculate a 32-bit CRC. */
> > > > +#define CRC_VARIANT_CRC32 0x1
> > > > +/* enum: Calculate a 64-bit CRC. */
> > > > +#define CRC_VARIANT_CRC64 0x2
> > > > +
> > > > +/* DPU_CSUM_OP enum: Operation for the DPU checksum engine to perform. */
> > > > +/* enum: Calculate the checksum for a TCP payload, output result on OPR bus. */
> > > > +#define DPU_CSUM_OP_CALC_TCP 0x0
> > > > +/* enum: Calculate the checksum for a UDP payload, output result on OPR bus. */
> > > > +#define DPU_CSUM_OP_CALC_UDP 0x1
> > > > +/* enum: Calculate the checksum for a TCP payload, output match/not match value
> > > > + * on OPR bus.
> > > > + */
> > > > +#define DPU_CSUM_OP_VALIDATE_TCP 0x2
> > > > +/* enum: Calculate the checksum for a UDP payload, output match/not match value
> > > > + * on OPR bus.
> > > > + */
> > > > +#define DPU_CSUM_OP_VALIDATE_UDP 0x3
> > > > +
> > > > +/* GCM_OP_CODE enum: Operation for the DPU AES-GCM engine to perform. */
> > > > +/* enum: Encrypt/decrypt a stream of data. */
> > > > +#define GCM_OP_CODE_BULK_CRYPT 0x0
> > > > +/* enum: Calculate the authentication tag for a stream of data. */
> > > > +#define GCM_OP_CODE_BULK_AUTH 0x1
> > > > +/* enum: Encrypt/decrypt an IPsec packet. */
> > > > +#define GCM_OP_CODE_IPSEC_CRYPT 0x2
> > > > +/* enum: Calculate the authentication tag of an IPsec packet. */
> > > > +#define GCM_OP_CODE_IPSEC_AUTH 0x3
> > > > +
> > > > +/* AES_KEY_LEN enum: Key size for AES crypto operations */
> > > > +/* enum: 128 bit key size. */
> > > > +#define AES_KEY_LEN_AES_KEY_128 0x0
> > > > +/* enum: 256 bit key size. */
> > > > +#define AES_KEY_LEN_AES_KEY_256 0x1
> > > > +
> > > > /* TABLE_FIELD_ID enum: Unique IDs for fields. Related concepts have been
> > > > * loosely grouped together into blocks with gaps for expansion, but the values
> > > > * are arbitrary. Field IDs are not specific to particular tables, and in some
> > > > @@ -1026,6 +1138,16 @@
> > > > #define TABLE_FIELD_ID_BAL_TBL_BASE_DIV64 0xde
> > > > /* enum: Length of balance table region: 0=>64, 1=>128, 2=>256. */
> > > > #define TABLE_FIELD_ID_BAL_TBL_LEN_ID 0xdf
> > > > +/* enum: LACP LAG ID (i.e. the low 3 bits of LACP LAG mport ID), indexing
> > > > + * LACP_LAG_Config_Table. Refer to SF-123102-TC.
> > > > + */
> > > > +#define TABLE_FIELD_ID_LACP_LAG_ID 0xe0
> > > > +/* enum: Address in LACP_Balance_Table. The balance table is partitioned
> > > > + * between LAGs according to the settings in LACP_LAG_Config_Table and then
> > > > + * indexed by the LACP hash, providing the mapping to destination mports. Refer
> > > > + * to SF-123102-TC.
> > > > + */
> > > > +#define TABLE_FIELD_ID_BAL_TBL_ADDR 0xe1
> > > > /* enum: UDP port to match for UDP-based encapsulations; required to be 0 for
> > > > * other encapsulation types.
> > > > */
> > > > @@ -1082,6 +1204,58 @@
> > > > #define TABLE_FIELD_ID_INDIR_TBL_LEN_ID 0x105
> > > > /* enum: An offset to be applied to the base destination queue ID. */
> > > > #define TABLE_FIELD_ID_INDIR_OFFSET 0x106
> > > > +/* enum: DPU offload engine profile ID to address. */
> > > > +#define TABLE_FIELD_ID_OE_PROFILE 0x3e8
> > > > +/* enum: Width of the CRC to calculate - see CRC_VARIANT enum. */
> > > > +#define TABLE_FIELD_ID_CRC_VARIANT 0x3f2
> > > > +/* enum: If set, reflect the bits of each input byte, bit 7 is LSB, bit 0 is
> > > > + * MSB. If clear, bit 7 is MSB, bit 0 is LSB.
> > > > + */
> > > > +#define TABLE_FIELD_ID_CRC_REFIN 0x3f3
> > > > +/* enum: If set, reflect the bits of each output byte, bit 7 is LSB, bit 0 is
> > > > + * MSB. If clear, bit 7 is MSB, bit 0 is LSB.
> > > > + */
> > > > +#define TABLE_FIELD_ID_CRC_REFOUT 0x3f4
> > > > +/* enum: If set, invert every bit of the output value. */
> > > > +#define TABLE_FIELD_ID_CRC_INVOUT 0x3f5
> > > > +/* enum: The CRC polynomial to use for checksumming, in normal form. See
> > > > + * https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Specification for a
> > > > + * description of normal form.
> > > > + */
> > > > +#define TABLE_FIELD_ID_CRC_POLY 0x3f6
> > > > +/* enum: Operation for the checksum engine to perform - see DPU_CSUM_OP enum.
> > > > + */
> > > > +#define TABLE_FIELD_ID_CSUM_OP 0x410
> > > > +/* enum: Byte offset of checksum relative to region_start (for VALIDATE_*
> > > > + * operations only).
> > > > + */
> > > > +#define TABLE_FIELD_ID_CSUM_OFFSET 0x411
> > > > +/* enum: Indicates there is additional data on OPR bus that needs to be
> > > > + * incorporated into the payload checksum.
> > > > + */
> > > > +#define TABLE_FIELD_ID_CSUM_OPR_ADDITIONAL_DATA 0x412
> > > > +/* enum: Log2 data size of additional data on OPR bus. */
> > > > +#define TABLE_FIELD_ID_CSUM_OPR_DATA_SIZE_LOG2 0x413
> > > > +/* enum: 4 byte offset of where to find the additional data on the OPR bus. */
> > > > +#define TABLE_FIELD_ID_CSUM_OPR_4B_OFF 0x414
> > > > +/* enum: Operation type for the AES-GCM core - see GCM_OP_CODE enum. */
> > > > +#define TABLE_FIELD_ID_GCM_OP_CODE 0x41a
> > > > +/* enum: Key length - AES_KEY_LEN enum. */
> > > > +#define TABLE_FIELD_ID_GCM_KEY_LEN 0x41b
> > > > +/* enum: OPR 4 byte offset for ICV or GHASH output (only in BULK_* mode) or
> > > > + * IPSEC descrypt output.
> > > > + */
> > > > +#define TABLE_FIELD_ID_GCM_OPR_4B_OFFSET 0x41c
> > > > +/* enum: If OP_CODE is BULK_*, indicates Emit GHASH (Fragment mode). Else,
> > > > + * indicates IPSEC-ESN mode.
> > > > + */
> > > > +#define TABLE_FIELD_ID_GCM_EMIT_GHASH_ISESN 0x41d
> > > > +/* enum: Replay Protection Enable. */
> > > > +#define TABLE_FIELD_ID_GCM_REPLAY_PROTECT_EN 0x41e
> > > > +/* enum: IPSEC Encrypt ESP trailer NEXT_HEADER byte. */
> > > > +#define TABLE_FIELD_ID_GCM_NEXT_HDR 0x41f
> > > > +/* enum: Replay Window Size. */
> > > > +#define TABLE_FIELD_ID_GCM_REPLAY_WIN_SIZE 0x420
> > > >
> > > > /* MCDI_EVENT structuredef: The structure of an MCDI_EVENT on Siena/EF10/EF100
> > > > * platforms
> > > > @@ -1237,7 +1411,7 @@
> > > > #define MCDI_EVENT_AOE_FPGA_LOAD_FAILED 0xe
> > > > /* enum: Notify that invalid flash type detected */
> > > > #define MCDI_EVENT_AOE_INVALID_FPGA_FLASH_TYPE 0xf
> > > > -/* enum: Notify that the attempt to run FPGA Controller firmware timedout */
> > > > +/* enum: Notify that the attempt to run FPGA Controller firmware timed out */
> > > > #define MCDI_EVENT_AOE_FC_RUN_TIMEDOUT 0x10
> > > > /* enum: Failure to probe one or more FPGA boot flash chips */
> > > > #define MCDI_EVENT_AOE_FPGA_BOOT_FLASH_INVALID 0x11
> > > > @@ -1255,7 +1429,7 @@
> > > > #define MCDI_EVENT_AOE_ERR_FC_ASSERT_INFO_WIDTH 8
> > > > /* enum: FC Assert happened, but the register information is not available */
> > > > #define MCDI_EVENT_AOE_ERR_FC_ASSERT_SEEN 0x0
> > > > -/* enum: The register information for FC Assert is ready for readinng by driver
> > > > +/* enum: The register information for FC Assert is ready for reading by driver
> > > > */
> > > > #define MCDI_EVENT_AOE_ERR_FC_ASSERT_DATA_READY 0x1
> > > > #define MCDI_EVENT_AOE_ERR_CODE_FPGA_HEADER_VERIFY_FAILED_OFST 0
> > > > @@ -1364,6 +1538,12 @@
> > > > #define MCDI_EVENT_MODULECHANGE_SEQ_OFST 0
> > > > #define MCDI_EVENT_MODULECHANGE_SEQ_LBN 30
> > > > #define MCDI_EVENT_MODULECHANGE_SEQ_WIDTH 2
> > > > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_OFST 0
> > > > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_LBN 0
> > > > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_VI_ID_WIDTH 16
> > > > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_OFST 0
> > > > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_LBN 16
> > > > +#define MCDI_EVENT_DESC_PROXY_VIRTQ_ID_WIDTH 16
> > > > #define MCDI_EVENT_DATA_LBN 0
> > > > #define MCDI_EVENT_DATA_WIDTH 32
> > > > /* Alias for PTP_DATA. */
> > > > @@ -1500,6 +1680,12 @@
> > > > * change to the journal.
> > > > */
> > > > #define MCDI_EVENT_CODE_MPORT_JOURNAL_CHANGE 0x27
> > > > +/* enum: Notification that a source queue is enabled and attached to its proxy
> > > > + * sink queue. SRC field contains the handle of the affected descriptor proxy
> > > > + * function. DATA field contains the relative source queue number and absolute
> > > > + * VI ID.
> > > > + */
> > > > +#define MCDI_EVENT_CODE_DESC_PROXY_FUNC_QUEUE_START 0x28
> > > > /* enum: Artificial event generated by host and posted via MC for test
> > > > * purposes.
> > > > */
> > > > @@ -1977,7 +2163,7 @@
> > > > #define MC_CMD_COPYCODE 0x3
> > > > #undef MC_CMD_0x3_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x3_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x3_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_COPYCODE_IN msgrequest */
> > > > #define MC_CMD_COPYCODE_IN_LEN 16
> > > > @@ -3943,11 +4129,15 @@
> > > > /***********************************/
> > > > /* MC_CMD_CSR_READ32
> > > > * Read 32bit words from the indirect memory map.
> > > > + *
> > > > + * Note - this command originally belonged to INSECURE category. But access is
> > > > + * required to specific registers for customer diagnostics. The command handler
> > > > + * has additional checks to reject insecure calls.
> > > > */
> > > > #define MC_CMD_CSR_READ32 0xc
> > > > #undef MC_CMD_0xc_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0xc_PRIVILEGE_CTG SRIOV_CTG_INSECURE
> > > > +#define MC_CMD_0xc_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > >
> > > > /* MC_CMD_CSR_READ32_IN msgrequest */
> > > > #define MC_CMD_CSR_READ32_IN_LEN 12
> > > > @@ -4013,7 +4203,7 @@
> > > > #define MC_CMD_HP 0x54
> > > > #undef MC_CMD_0x54_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x54_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x54_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_HP_IN msgrequest */
> > > > #define MC_CMD_HP_IN_LEN 16
> > > > @@ -4931,6 +5121,53 @@
> > > > /* MC_CMD_GET_PHY_CFG_IN msgrequest */
> > > > #define MC_CMD_GET_PHY_CFG_IN_LEN 0
> > > >
> > > > +/* MC_CMD_GET_PHY_CFG_IN_V2 msgrequest */
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_LEN 8
> > > > +/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > > > + * identifies a real or virtual network port by MAE port and link end. See the
> > > > + * structure definition for more details
> > > > + */
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_OFST 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LEN 8
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_OFST 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_LEN 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_LBN 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LO_WIDTH 32
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_OFST 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_LEN 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_LBN 32
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_HI_WIDTH 32
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LINK_END_OFST 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_LINK_END_LEN 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_OFST 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LEN 8
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_OFST 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_LEN 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_LBN 0
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_LO_WIDTH 32
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_OFST 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_LEN 4
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_LBN 32
> > > > +#define MC_CMD_GET_PHY_CFG_IN_V2_TARGET_FLAT_HI_WIDTH 32
> > > > +
> > > > /* MC_CMD_GET_PHY_CFG_OUT msgresponse */
> > > > #define MC_CMD_GET_PHY_CFG_OUT_LEN 72
> > > > /* flags */
> > > > @@ -5026,6 +5263,9 @@
> > > > #define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_OFST 8
> > > > #define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_LBN 21
> > > > #define MC_CMD_PHY_CAP_25G_BASER_FEC_REQUESTED_WIDTH 1
> > > > +#define MC_CMD_PHY_CAP_200000FDX_OFST 8
> > > > +#define MC_CMD_PHY_CAP_200000FDX_LBN 22
> > > > +#define MC_CMD_PHY_CAP_200000FDX_WIDTH 1
> > > > /* ?? */
> > > > #define MC_CMD_GET_PHY_CFG_OUT_CHANNEL_OFST 12
> > > > #define MC_CMD_GET_PHY_CFG_OUT_CHANNEL_LEN 4
> > > > @@ -5084,7 +5324,7 @@
> > > > #define MC_CMD_START_BIST 0x25
> > > > #undef MC_CMD_0x25_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x25_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x25_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_START_BIST_IN msgrequest */
> > > > #define MC_CMD_START_BIST_IN_LEN 4
> > > > @@ -5124,7 +5364,7 @@
> > > > #define MC_CMD_POLL_BIST 0x26
> > > > #undef MC_CMD_0x26_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x26_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x26_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_POLL_BIST_IN msgrequest */
> > > > #define MC_CMD_POLL_BIST_IN_LEN 0
> > > > @@ -5320,6 +5560,53 @@
> > > > /* MC_CMD_GET_LOOPBACK_MODES_IN msgrequest */
> > > > #define MC_CMD_GET_LOOPBACK_MODES_IN_LEN 0
> > > >
> > > > +/* MC_CMD_GET_LOOPBACK_MODES_IN_V2 msgrequest */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_LEN 8
> > > > +/* Target port to request loopback modes for. Uses MAE_LINK_ENDPOINT_SELECTOR
> > > > + * which identifies a real or virtual network port by MAE port and link end.
> > > > + * See the structure definition for more details
> > > > + */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_OFST 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_OFST 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_LBN 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_OFST 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_LBN 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_HI_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LINK_END_OFST 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_LINK_END_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_OFST 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_OFST 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_LBN 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_OFST 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_LBN 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_IN_V2_TARGET_FLAT_HI_WIDTH 32
> > > > +
> > > > /* MC_CMD_GET_LOOPBACK_MODES_OUT msgresponse */
> > > > #define MC_CMD_GET_LOOPBACK_MODES_OUT_LEN 40
> > > > /* Supported loopbacks. */
> > > > @@ -5649,6 +5936,204 @@
> > > > /* Enum values, see field(s): */
> > > > /* 100M */
> > > >
> > > > +/* MC_CMD_GET_LOOPBACK_MODES_OUT_V3 msgresponse: Supported loopback modes for
> > > > + * newer NICs with 200G support
> > > > + */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_LEN 72
> > > > +/* Supported loopbacks. */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_OFST 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_OFST 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_LBN 0
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_OFST 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_LBN 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100M_HI_WIDTH 32
> > > > +/* enum: None. */
> > > > +/* MC_CMD_LOOPBACK_NONE 0x0 */
> > > > +/* enum: Data. */
> > > > +/* MC_CMD_LOOPBACK_DATA 0x1 */
> > > > +/* enum: GMAC. */
> > > > +/* MC_CMD_LOOPBACK_GMAC 0x2 */
> > > > +/* enum: XGMII. */
> > > > +/* MC_CMD_LOOPBACK_XGMII 0x3 */
> > > > +/* enum: XGXS. */
> > > > +/* MC_CMD_LOOPBACK_XGXS 0x4 */
> > > > +/* enum: XAUI. */
> > > > +/* MC_CMD_LOOPBACK_XAUI 0x5 */
> > > > +/* enum: GMII. */
> > > > +/* MC_CMD_LOOPBACK_GMII 0x6 */
> > > > +/* enum: SGMII. */
> > > > +/* MC_CMD_LOOPBACK_SGMII 0x7 */
> > > > +/* enum: XGBR. */
> > > > +/* MC_CMD_LOOPBACK_XGBR 0x8 */
> > > > +/* enum: XFI. */
> > > > +/* MC_CMD_LOOPBACK_XFI 0x9 */
> > > > +/* enum: XAUI Far. */
> > > > +/* MC_CMD_LOOPBACK_XAUI_FAR 0xa */
> > > > +/* enum: GMII Far. */
> > > > +/* MC_CMD_LOOPBACK_GMII_FAR 0xb */
> > > > +/* enum: SGMII Far. */
> > > > +/* MC_CMD_LOOPBACK_SGMII_FAR 0xc */
> > > > +/* enum: XFI Far. */
> > > > +/* MC_CMD_LOOPBACK_XFI_FAR 0xd */
> > > > +/* enum: GPhy. */
> > > > +/* MC_CMD_LOOPBACK_GPHY 0xe */
> > > > +/* enum: PhyXS. */
> > > > +/* MC_CMD_LOOPBACK_PHYXS 0xf */
> > > > +/* enum: PCS. */
> > > > +/* MC_CMD_LOOPBACK_PCS 0x10 */
> > > > +/* enum: PMA-PMD. */
> > > > +/* MC_CMD_LOOPBACK_PMAPMD 0x11 */
> > > > +/* enum: Cross-Port. */
> > > > +/* MC_CMD_LOOPBACK_XPORT 0x12 */
> > > > +/* enum: XGMII-Wireside. */
> > > > +/* MC_CMD_LOOPBACK_XGMII_WS 0x13 */
> > > > +/* enum: XAUI Wireside. */
> > > > +/* MC_CMD_LOOPBACK_XAUI_WS 0x14 */
> > > > +/* enum: XAUI Wireside Far. */
> > > > +/* MC_CMD_LOOPBACK_XAUI_WS_FAR 0x15 */
> > > > +/* enum: XAUI Wireside near. */
> > > > +/* MC_CMD_LOOPBACK_XAUI_WS_NEAR 0x16 */
> > > > +/* enum: GMII Wireside. */
> > > > +/* MC_CMD_LOOPBACK_GMII_WS 0x17 */
> > > > +/* enum: XFI Wireside. */
> > > > +/* MC_CMD_LOOPBACK_XFI_WS 0x18 */
> > > > +/* enum: XFI Wireside Far. */
> > > > +/* MC_CMD_LOOPBACK_XFI_WS_FAR 0x19 */
> > > > +/* enum: PhyXS Wireside. */
> > > > +/* MC_CMD_LOOPBACK_PHYXS_WS 0x1a */
> > > > +/* enum: PMA lanes MAC-Serdes. */
> > > > +/* MC_CMD_LOOPBACK_PMA_INT 0x1b */
> > > > +/* enum: KR Serdes Parallel (Encoder). */
> > > > +/* MC_CMD_LOOPBACK_SD_NEAR 0x1c */
> > > > +/* enum: KR Serdes Serial. */
> > > > +/* MC_CMD_LOOPBACK_SD_FAR 0x1d */
> > > > +/* enum: PMA lanes MAC-Serdes Wireside. */
> > > > +/* MC_CMD_LOOPBACK_PMA_INT_WS 0x1e */
> > > > +/* enum: KR Serdes Parallel Wireside (Full PCS). */
> > > > +/* MC_CMD_LOOPBACK_SD_FEP2_WS 0x1f */
> > > > +/* enum: KR Serdes Parallel Wireside (Sym Aligner to TX). */
> > > > +/* MC_CMD_LOOPBACK_SD_FEP1_5_WS 0x20 */
> > > > +/* enum: KR Serdes Parallel Wireside (Deserializer to Serializer). */
> > > > +/* MC_CMD_LOOPBACK_SD_FEP_WS 0x21 */
> > > > +/* enum: KR Serdes Serial Wireside. */
> > > > +/* MC_CMD_LOOPBACK_SD_FES_WS 0x22 */
> > > > +/* enum: Near side of AOE Siena side port */
> > > > +/* MC_CMD_LOOPBACK_AOE_INT_NEAR 0x23 */
> > > > +/* enum: Medford Wireside datapath loopback */
> > > > +/* MC_CMD_LOOPBACK_DATA_WS 0x24 */
> > > > +/* enum: Force link up without setting up any physical loopback (snapper use
> > > > + * only)
> > > > + */
> > > > +/* MC_CMD_LOOPBACK_FORCE_EXT_LINK 0x25 */
> > > > +/* Supported loopbacks. */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_OFST 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_OFST 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_LBN 64
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_OFST 12
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_LBN 96
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_1G_HI_WIDTH 32
> > > > +/* Enum values, see field(s): */
> > > > +/* 100M */
> > > > +/* Supported loopbacks. */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_OFST 16
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_OFST 16
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_LBN 128
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_OFST 20
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_LBN 160
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_10G_HI_WIDTH 32
> > > > +/* Enum values, see field(s): */
> > > > +/* 100M */
> > > > +/* Supported loopbacks. */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_OFST 24
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_OFST 24
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_LBN 192
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_OFST 28
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_LBN 224
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_SUGGESTED_HI_WIDTH 32
> > > > +/* Enum values, see field(s): */
> > > > +/* 100M */
> > > > +/* Supported loopbacks. */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_OFST 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_OFST 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_LBN 256
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_OFST 36
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_LBN 288
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_40G_HI_WIDTH 32
> > > > +/* Enum values, see field(s): */
> > > > +/* 100M */
> > > > +/* Supported 25G loopbacks. */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_OFST 40
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_OFST 40
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_LBN 320
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_OFST 44
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_LBN 352
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_25G_HI_WIDTH 32
> > > > +/* Enum values, see field(s): */
> > > > +/* 100M */
> > > > +/* Supported 50 loopbacks. */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_OFST 48
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_OFST 48
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_LBN 384
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_OFST 52
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_LBN 416
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_50G_HI_WIDTH 32
> > > > +/* Enum values, see field(s): */
> > > > +/* 100M */
> > > > +/* Supported 100G loopbacks. */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_OFST 56
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_OFST 56
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_LBN 448
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_OFST 60
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_LBN 480
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_100G_HI_WIDTH 32
> > > > +/* Enum values, see field(s): */
> > > > +/* 100M */
> > > > +/* Supported 200G loopbacks. */
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_OFST 64
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LEN 8
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_OFST 64
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_LBN 512
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_OFST 68
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_LEN 4
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_LBN 544
> > > > +#define MC_CMD_GET_LOOPBACK_MODES_OUT_V3_200G_HI_WIDTH 32
> > > > +/* Enum values, see field(s): */
> > > > +/* 100M */
> > > > +
> > > > /* AN_TYPE structuredef: Auto-negotiation types defined in IEEE802.3 */
> > > > #define AN_TYPE_LEN 4
> > > > #define AN_TYPE_TYPE_OFST 0
> > > > @@ -5694,6 +6179,53 @@
> > > > /* MC_CMD_GET_LINK_IN msgrequest */
> > > > #define MC_CMD_GET_LINK_IN_LEN 0
> > > >
> > > > +/* MC_CMD_GET_LINK_IN_V2 msgrequest */
> > > > +#define MC_CMD_GET_LINK_IN_V2_LEN 8
> > > > +/* Target port to request link state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > > > + * identifies a real or virtual network port by MAE port and link end. See the
> > > > + * structure definition for more details.
> > > > + */
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_OFST 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LEN 8
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_OFST 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_LEN 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_LBN 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_OFST 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_LEN 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_LBN 32
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_HI_WIDTH 32
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LINK_END_OFST 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_LINK_END_LEN 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_OFST 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LEN 8
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_OFST 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_LEN 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_LBN 0
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_LO_WIDTH 32
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_OFST 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_LEN 4
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_LBN 32
> > > > +#define MC_CMD_GET_LINK_IN_V2_TARGET_FLAT_HI_WIDTH 32
> > > > +
> > > > /* MC_CMD_GET_LINK_OUT msgresponse */
> > > > #define MC_CMD_GET_LINK_OUT_LEN 28
> > > > /* Near-side advertised capabilities. Refer to
> > > > @@ -5969,6 +6501,94 @@
> > > > #define MC_CMD_SET_LINK_IN_V2_MODULE_SEQ_IGNORE_LBN 7
> > > > #define MC_CMD_SET_LINK_IN_V2_MODULE_SEQ_IGNORE_WIDTH 1
> > > >
> > > > +/* MC_CMD_SET_LINK_IN_V3 msgrequest */
> > > > +#define MC_CMD_SET_LINK_IN_V3_LEN 28
> > > > +/* Near-side advertised capabilities. Refer to
> > > > + * MC_CMD_GET_PHY_CFG_OUT/SUPPORTED_CAP for bit definitions.
> > > > + */
> > > > +#define MC_CMD_SET_LINK_IN_V3_CAP_OFST 0
> > > > +#define MC_CMD_SET_LINK_IN_V3_CAP_LEN 4
> > > > +/* Flags */
> > > > +#define MC_CMD_SET_LINK_IN_V3_FLAGS_OFST 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_FLAGS_LEN 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_OFST 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_LBN 0
> > > > +#define MC_CMD_SET_LINK_IN_V3_LOWPOWER_WIDTH 1
> > > > +#define MC_CMD_SET_LINK_IN_V3_POWEROFF_OFST 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_POWEROFF_LBN 1
> > > > +#define MC_CMD_SET_LINK_IN_V3_POWEROFF_WIDTH 1
> > > > +#define MC_CMD_SET_LINK_IN_V3_TXDIS_OFST 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TXDIS_LBN 2
> > > > +#define MC_CMD_SET_LINK_IN_V3_TXDIS_WIDTH 1
> > > > +#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_OFST 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_LBN 3
> > > > +#define MC_CMD_SET_LINK_IN_V3_LINKDOWN_WIDTH 1
> > > > +/* Loopback mode. */
> > > > +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_MODE_OFST 8
> > > > +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_MODE_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MC_CMD_GET_LOOPBACK_MODES/MC_CMD_GET_LOOPBACK_MODES_OUT/100M */
> > > > +/* A loopback speed of "0" is supported, and means (choose any available
> > > > + * speed).
> > > > + */
> > > > +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_SPEED_OFST 12
> > > > +#define MC_CMD_SET_LINK_IN_V3_LOOPBACK_SPEED_LEN 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_OFST 16
> > > > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_LEN 1
> > > > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_OFST 16
> > > > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_LBN 0
> > > > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_NUMBER_WIDTH 7
> > > > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_OFST 16
> > > > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_LBN 7
> > > > +#define MC_CMD_SET_LINK_IN_V3_MODULE_SEQ_IGNORE_WIDTH 1
> > > > +/* Padding */
> > > > +#define MC_CMD_SET_LINK_IN_V3_RESERVED_OFST 17
> > > > +#define MC_CMD_SET_LINK_IN_V3_RESERVED_LEN 3
> > > > +/* Target port to set link state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > > > + * identifies a real or virtual network port by MAE port and link end. See the
> > > > + * structure definition for more details
> > > > + */
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_OFST 20
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LEN 8
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_OFST 20
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_LEN 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_LBN 160
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LO_WIDTH 32
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_OFST 24
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_LEN 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_LBN 192
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_HI_WIDTH 32
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_OFST 20
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_LEN 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FLAT_OFST 20
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_TYPE_OFST 23
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 20
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 160
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 180
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 176
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 22
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 20
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LINK_END_OFST 24
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_LINK_END_LEN 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_OFST 20
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LEN 8
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_OFST 20
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_LEN 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_LBN 160
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_LO_WIDTH 32
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_OFST 24
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_LEN 4
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_LBN 192
> > > > +#define MC_CMD_SET_LINK_IN_V3_TARGET_FLAT_HI_WIDTH 32
> > > > +
> > > > /* MC_CMD_SET_LINK_OUT msgresponse */
> > > > #define MC_CMD_SET_LINK_OUT_LEN 0
> > > >
> > > > @@ -6188,19 +6808,9 @@
> > > > #define MC_CMD_SET_MAC_V3_IN_CFG_FCS_OFST 28
> > > > #define MC_CMD_SET_MAC_V3_IN_CFG_FCS_LBN 4
> > > > #define MC_CMD_SET_MAC_V3_IN_CFG_FCS_WIDTH 1
> > > > -/* Identifies the MAC to update by the specifying the end of a logical MAE
> > > > - * link. Setting TARGET to MAE_LINK_ENDPOINT_COMPAT is equivalent to using the
> > > > - * previous version of the command (MC_CMD_SET_MAC_EXT). Not all possible
> > > > - * combinations of MPORT_END and MPORT_SELECTOR in TARGET will work in all
> > > > - * circumstances. 1. Some will always work (e.g. a VF can always address its
> > > > - * logical MAC using MPORT_SELECTOR=ASSIGNED,LINK_END=VNIC), 2. Some are not
> > > > - * meaningful and will always fail with EINVAL (e.g. attempting to address the
> > > > - * VNIC end of a link to a physical port), 3. Some are meaningful but require
> > > > - * the MCDI client to have the required permission and fail with EPERM
> > > > - * otherwise (e.g. trying to set the MAC on a VF the caller cannot administer),
> > > > - * and 4. Some could be implementation-specific and fail with ENOTSUP if not
> > > > - * available (no examples exist right now). See SF-123581-TC section 4.3 for
> > > > - * more details.
> > > > +/* Target port to set mac state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > > > + * identifies a real or virtual network port by MAE port and link end. See the
> > > > + * structure definition for more details
> > > > */
> > > > #define MC_CMD_SET_MAC_V3_IN_TARGET_OFST 32
> > > > #define MC_CMD_SET_MAC_V3_IN_TARGET_LEN 8
> > > > @@ -6405,6 +7015,97 @@
> > > > #define MC_CMD_MAC_STATS_IN_PORT_ID_OFST 16
> > > > #define MC_CMD_MAC_STATS_IN_PORT_ID_LEN 4
> > > >
> > > > +/* MC_CMD_MAC_STATS_V2_IN msgrequest */
> > > > +#define MC_CMD_MAC_STATS_V2_IN_LEN 28
> > > > +/* ??? */
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_OFST 0
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LEN 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_OFST 0
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_LEN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_LBN 0
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_LO_WIDTH 32
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_OFST 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_LEN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_LBN 32
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_ADDR_HI_WIDTH 32
> > > > +#define MC_CMD_MAC_STATS_V2_IN_CMD_OFST 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_CMD_LEN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_OFST 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_LBN 0
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_WIDTH 1
> > > > +#define MC_CMD_MAC_STATS_V2_IN_CLEAR_OFST 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_CLEAR_LBN 1
> > > > +#define MC_CMD_MAC_STATS_V2_IN_CLEAR_WIDTH 1
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_OFST 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_LBN 2
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CHANGE_WIDTH 1
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_OFST 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_LBN 3
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_ENABLE_WIDTH 1
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_OFST 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_LBN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_CLEAR_WIDTH 1
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_OFST 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_LBN 5
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIODIC_NOEVENT_WIDTH 1
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_OFST 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_LBN 16
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PERIOD_MS_WIDTH 16
> > > > +/* DMA length. Should be set to MAC_STATS_NUM_STATS * sizeof(uint64_t), as
> > > > + * returned by MC_CMD_GET_CAPABILITIES_V4_OUT. For legacy firmware not
> > > > + * supporting MC_CMD_GET_CAPABILITIES_V4_OUT, DMA_LEN should be set to
> > > > + * MC_CMD_MAC_NSTATS * sizeof(uint64_t)
> > > > + */
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_LEN_OFST 12
> > > > +#define MC_CMD_MAC_STATS_V2_IN_DMA_LEN_LEN 4
> > > > +/* port id so vadapter stats can be provided */
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PORT_ID_OFST 16
> > > > +#define MC_CMD_MAC_STATS_V2_IN_PORT_ID_LEN 4
> > > > +/* Target port to request statistics for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > > > + * identifies a real or virtual network port by MAE port and link end. See the
> > > > + * structure definition for more details
> > > > + */
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_OFST 20
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LEN 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_OFST 20
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_LEN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_LBN 160
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LO_WIDTH 32
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_OFST 24
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_LEN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_LBN 192
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_HI_WIDTH 32
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_OFST 20
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_LEN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FLAT_OFST 20
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_TYPE_OFST 23
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 20
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 160
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 180
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 176
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 22
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 20
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LINK_END_OFST 24
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_LINK_END_LEN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_OFST 20
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LEN 8
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_OFST 20
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_LEN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_LBN 160
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_LO_WIDTH 32
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_OFST 24
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_LEN 4
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_LBN 192
> > > > +#define MC_CMD_MAC_STATS_V2_IN_TARGET_FLAT_HI_WIDTH 32
> > > > +
> > > > /* MC_CMD_MAC_STATS_OUT_DMA msgresponse */
> > > > #define MC_CMD_MAC_STATS_OUT_DMA_LEN 0
> > > >
> > > > @@ -7522,7 +8223,7 @@
> > > > #define MC_CMD_REBOOT 0x3d
> > > > #undef MC_CMD_0x3d_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x3d_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x3d_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_REBOOT_IN msgrequest */
> > > > #define MC_CMD_REBOOT_IN_LEN 4
> > > > @@ -8061,6 +8762,53 @@
> > > > /* MC_CMD_GET_PHY_STATE_IN msgrequest */
> > > > #define MC_CMD_GET_PHY_STATE_IN_LEN 0
> > > >
> > > > +/* MC_CMD_GET_PHY_STATE_IN_V2 msgrequest */
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_LEN 8
> > > > +/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > > > + * identifies a real or virtual network port by MAE port and link end. See the
> > > > + * structure definition for more details.
> > > > + */
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_OFST 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LEN 8
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_OFST 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_LEN 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_LBN 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LO_WIDTH 32
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_OFST 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_LEN 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_LBN 32
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_HI_WIDTH 32
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_OFST 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 3
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 20
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 16
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 2
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LINK_END_OFST 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_LINK_END_LEN 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_OFST 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LEN 8
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_OFST 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_LEN 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_LBN 0
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_LO_WIDTH 32
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_OFST 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_LEN 4
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_LBN 32
> > > > +#define MC_CMD_GET_PHY_STATE_IN_V2_TARGET_FLAT_HI_WIDTH 32
> > > > +
> > > > /* MC_CMD_GET_PHY_STATE_OUT msgresponse */
> > > > #define MC_CMD_GET_PHY_STATE_OUT_LEN 4
> > > > #define MC_CMD_GET_PHY_STATE_OUT_STATE_OFST 0
> > > > @@ -8200,7 +8948,7 @@
> > > > #define MC_CMD_TESTASSERT 0x49
> > > > #undef MC_CMD_0x49_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x49_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x49_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_TESTASSERT_IN msgrequest */
> > > > #define MC_CMD_TESTASSERT_IN_LEN 0
> > > > @@ -8324,6 +9072,61 @@
> > > > #define MC_CMD_GET_PHY_MEDIA_INFO_IN_DSFP_BANK_LBN 16
> > > > #define MC_CMD_GET_PHY_MEDIA_INFO_IN_DSFP_BANK_WIDTH 16
> > > >
> > > > +/* MC_CMD_GET_PHY_MEDIA_INFO_IN_V2 msgrequest */
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_LEN 12
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_PAGE_OFST 0
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_PAGE_LEN 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_OFST 0
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_LBN 0
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_PAGE_WIDTH 16
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_OFST 0
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_LBN 16
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_DSFP_BANK_WIDTH 16
> > > > +/* Target port to request PHY state for. Uses MAE_LINK_ENDPOINT_SELECTOR which
> > > > + * identifies a real or virtual network port by MAE port and link end. See the
> > > > + * structure definition for more details
> > > > + */
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_OFST 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LEN 8
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_OFST 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_LEN 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_LBN 32
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LO_WIDTH 32
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_OFST 8
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_LEN 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_LBN 64
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_HI_WIDTH 32
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_OFST 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_LEN 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FLAT_OFST 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FLAT_LEN 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_TYPE_OFST 7
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_TYPE_LEN 1
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_OFST 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_MPORT_ID_LEN 3
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_LBN 32
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_PPORT_ID_WIDTH 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_LBN 52
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_INTF_ID_WIDTH 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_LBN 48
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_MH_PF_ID_WIDTH 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_OFST 6
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_PF_ID_LEN 1
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_OFST 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_MPORT_SELECTOR_FUNC_VF_ID_LEN 2
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LINK_END_OFST 8
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_LINK_END_LEN 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_OFST 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LEN 8
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_OFST 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_LEN 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_LBN 32
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_LO_WIDTH 32
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_OFST 8
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_LEN 4
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_LBN 64
> > > > +#define MC_CMD_GET_PHY_MEDIA_INFO_IN_V2_TARGET_FLAT_HI_WIDTH 32
> > > > +
> > > > /* MC_CMD_GET_PHY_MEDIA_INFO_OUT msgresponse */
> > > > #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMIN 5
> > > > #define MC_CMD_GET_PHY_MEDIA_INFO_OUT_LENMAX 252
> > > > @@ -8348,7 +9151,7 @@
> > > > #define MC_CMD_NVRAM_TEST 0x4c
> > > > #undef MC_CMD_0x4c_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x4c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x4c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_NVRAM_TEST_IN msgrequest */
> > > > #define MC_CMD_NVRAM_TEST_IN_LEN 4
> > > > @@ -8593,7 +9396,7 @@
> > > > #define MC_CMD_CLP 0x56
> > > > #undef MC_CMD_0x56_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x56_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x56_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_CLP_IN msgrequest */
> > > > #define MC_CMD_CLP_IN_LEN 4
> > > > @@ -9500,27 +10303,22 @@
> > > > * and a generation count for this version of the sensor table. On systems
> > > > * advertising the DYNAMIC_SENSORS capability bit, this replaces the
> > > > * MC_CMD_READ_SENSORS command. On multi-MC systems this may include sensors
> > > > - * added by the NMC.
> > > > - *
> > > > - * Sensor handles are persistent for the lifetime of the sensor and are used to
> > > > - * identify sensors in MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS and
> > > > - * MC_CMD_DYNAMIC_SENSORS_GET_VALUES.
> > > > - *
> > > > - * The generation count is maintained by the MC, is persistent across reboots
> > > > - * and will be incremented each time the sensor table is modified. When the
> > > > - * table is modified, a CODE_DYNAMIC_SENSORS_CHANGE event will be generated
> > > > - * containing the new generation count. The driver should compare this against
> > > > - * the current generation count, and if it is different, call
> > > > - * MC_CMD_DYNAMIC_SENSORS_LIST again to update it's copy of the sensor table.
> > > > - *
> > > > - * The sensor count is provided to allow a future path to supporting more than
> > > > + * added by the NMC. Sensor handles are persistent for the lifetime of the
> > > > + * sensor and are used to identify sensors in
> > > > + * MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS and
> > > > + * MC_CMD_DYNAMIC_SENSORS_GET_VALUES. The generation count is maintained by the
> > > > + * MC, is persistent across reboots and will be incremented each time the
> > > > + * sensor table is modified. When the table is modified, a
> > > > + * CODE_DYNAMIC_SENSORS_CHANGE event will be generated containing the new
> > > > + * generation count. The driver should compare this against the current
> > > > + * generation count, and if it is different, call MC_CMD_DYNAMIC_SENSORS_LIST
> > > > + * again to update it's copy of the sensor table. The sensor count is provided
> > > > + * to allow a future path to supporting more than
> > > > * MC_CMD_DYNAMIC_SENSORS_GET_READINGS_IN_HANDLES_MAXNUM_MCDI2 sensors, i.e.
> > > > * the maximum number that will fit in a single response. As this is a fairly
> > > > * large number (253) it is not anticipated that this will be needed in the
> > > > - * near future, so can currently be ignored.
> > > > - *
> > > > - * On Riverhead this command is implemented as a wrapper for `list` in the
> > > > - * sensor_query SPHINX service.
> > > > + * near future, so can currently be ignored. On Riverhead this command is
> > > > + * implemented as a wrapper for `list` in the sensor_query SPHINX service.
> > > > */
> > > > #define MC_CMD_DYNAMIC_SENSORS_LIST 0x66
> > > > #undef MC_CMD_0x66_PRIVILEGE_CTG
> > > > @@ -9557,15 +10355,13 @@
> > > > /***********************************/
> > > > /* MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS
> > > > * Get descriptions for a set of sensors, specified as an array of sensor
> > > > - * handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST
> > > > - *
> > > > - * Any handles which do not correspond to a sensor currently managed by the MC
> > > > - * will be dropped from from the response. This may happen when a sensor table
> > > > - * update is in progress, and effectively means the set of usable sensors is
> > > > - * the intersection between the sets of sensors known to the driver and the MC.
> > > > - *
> > > > - * On Riverhead this command is implemented as a wrapper for
> > > > - * `get_descriptions` in the sensor_query SPHINX service.
> > > > + * handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST. Any handles which do not
> > > > + * correspond to a sensor currently managed by the MC will be dropped from from
> > > > + * the response. This may happen when a sensor table update is in progress, and
> > > > + * effectively means the set of usable sensors is the intersection between the
> > > > + * sets of sensors known to the driver and the MC. On Riverhead this command is
> > > > + * implemented as a wrapper for `get_descriptions` in the sensor_query SPHINX
> > > > + * service.
> > > > */
> > > > #define MC_CMD_DYNAMIC_SENSORS_GET_DESCRIPTIONS 0x67
> > > > #undef MC_CMD_0x67_PRIVILEGE_CTG
> > > > @@ -9602,19 +10398,15 @@
> > > > /***********************************/
> > > > /* MC_CMD_DYNAMIC_SENSORS_GET_READINGS
> > > > * Read the state and value for a set of sensors, specified as an array of
> > > > - * sensor handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST.
> > > > - *
> > > > - * In the case of a broken sensor, then the state of the response's
> > > > - * MC_CMD_DYNAMIC_SENSORS_VALUE entry will be set to BROKEN, and any value
> > > > - * provided should be treated as erroneous.
> > > > - *
> > > > - * Any handles which do not correspond to a sensor currently managed by the MC
> > > > - * will be dropped from from the response. This may happen when a sensor table
> > > > - * update is in progress, and effectively means the set of usable sensors is
> > > > - * the intersection between the sets of sensors known to the driver and the MC.
> > > > - *
> > > > - * On Riverhead this command is implemented as a wrapper for `get_readings`
> > > > - * in the sensor_query SPHINX service.
> > > > + * sensor handles as returned by MC_CMD_DYNAMIC_SENSORS_LIST. In the case of a
> > > > + * broken sensor, then the state of the response's MC_CMD_DYNAMIC_SENSORS_VALUE
> > > > + * entry will be set to BROKEN, and any value provided should be treated as
> > > > + * erroneous. Any handles which do not correspond to a sensor currently managed
> > > > + * by the MC will be dropped from from the response. This may happen when a
> > > > + * sensor table update is in progress, and effectively means the set of usable
> > > > + * sensors is the intersection between the sets of sensors known to the driver
> > > > + * and the MC. On Riverhead this command is implemented as a wrapper for
> > > > + * `get_readings` in the sensor_query SPHINX service.
> > > > */
> > > > #define MC_CMD_DYNAMIC_SENSORS_GET_READINGS 0x68
> > > > #undef MC_CMD_0x68_PRIVILEGE_CTG
> > > > @@ -10212,6 +11004,42 @@
> > > > #define CTPIO_STATS_MAP_BUCKET_LBN 16
> > > > #define CTPIO_STATS_MAP_BUCKET_WIDTH 16
> > > >
> > > > +/* MESSAGE_TYPE structuredef: When present this defines the meaning of a
> > > > + * message, and is used to protect against chosen message attacks in signed
> > > > + * messages, regardless their origin. The message type also defines the
> > > > + * signature cryptographic algorithm, encoding, and message fields included in
> > > > + * the signature. The values are used in different commands but must be unique
> > > > + * across all commands, e.g. MC_CMD_TSA_BIND_IN_SECURE_UNBIND uses different
> > > > + * message type than MC_CMD_SECURE_NIC_INFO_IN_STATUS.
> > > > + */
> > > > +#define MESSAGE_TYPE_LEN 4
> > > > +#define MESSAGE_TYPE_MESSAGE_TYPE_OFST 0
> > > > +#define MESSAGE_TYPE_MESSAGE_TYPE_LEN 4
> > > > +#define MESSAGE_TYPE_UNUSED 0x0 /* enum */
> > > > +/* enum: Message type value for the response to a
> > > > + * MC_CMD_TSA_BIND_IN_SECURE_UNBIND message. TSA_SECURE_UNBIND messages are
> > > > + * ECDSA SECP384R1 signed using SHA384 message digest algorithm over fields
> > > > + * MESSAGE_TYPE, TSANID, TSAID, and UNBINDTOKEN, and encoded as suggested by
> > > > + * RFC6979 (section 2.4).
> > > > + */
> > > > +#define MESSAGE_TYPE_TSA_SECURE_UNBIND 0x1
> > > > +/* enum: Message type value for the response to a
> > > > + * MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION message. TSA_SECURE_DECOMMISSION
> > > > + * messages are ECDSA SECP384R1 signed using SHA384 message digest algorithm
> > > > + * over fields MESSAGE_TYPE, TSAID, USER, and REASON, and encoded as suggested
> > > > + * by RFC6979 (section 2.4).
> > > > + */
> > > > +#define MESSAGE_TYPE_TSA_SECURE_DECOMMISSION 0x2
> > > > +/* enum: Message type value for the response to a
> > > > + * MC_CMD_SECURE_NIC_INFO_IN_STATUS message. This enum value is not sequential
> > > > + * to other message types for backwards compatibility as the message type for
> > > > + * MC_CMD_SECURE_NIC_INFO_IN_STATUS was defined before the existence of this
> > > > + * global enum.
> > > > + */
> > > > +#define MESSAGE_TYPE_SECURE_NIC_INFO_STATUS 0xdb4
> > > > +#define MESSAGE_TYPE_MESSAGE_TYPE_LBN 0
> > > > +#define MESSAGE_TYPE_MESSAGE_TYPE_WIDTH 32
> > > > +
> > > >
> > > > /***********************************/
> > > > /* MC_CMD_READ_REGS
> > > > @@ -12860,6 +13688,48 @@
> > > > #define MC_CMD_GET_PARSER_DISP_RESTRICTIONS_OUT_DST_IP_MCAST_ONLY_LBN 0
> > > > #define MC_CMD_GET_PARSER_DISP_RESTRICTIONS_OUT_DST_IP_MCAST_ONLY_WIDTH 1
> > > >
> > > > +/* MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT msgresponse:
> > > > + * GET_PARSER_DISP_INFO response format for OP_GET_SECURITY_RULE_INFO.
> > > > + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
> > > > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > > > + * been used in any released code and may change during development. This note
> > > > + * will be removed once it is regarded as stable.
> > > > + */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_LEN 36
> > > > +/* identifies the type of operation requested */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_OP_OFST 0
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_OP_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MC_CMD_GET_PARSER_DISP_INFO_IN/OP */
> > > > +/* a version number representing the set of rule lookups that are implemented
> > > > + * by the currently running firmware
> > > > + */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_OFST 4
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_LEN 4
> > > > +/* enum: implements lookup sequences described in SF-114946-SW draft C */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_RULES_VERSION_SF_114946_SW_C 0x0
> > > > +/* the number of nodes in the subnet map */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_NODES_OFST 8
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_NODES_LEN 4
> > > > +/* the number of entries in one subnet map node */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_ENTRIES_PER_NODE_OFST 12
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_MAP_NUM_ENTRIES_PER_NODE_LEN 4
> > > > +/* minimum valid value for a subnet ID in a subnet map leaf */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MIN_OFST 16
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MIN_LEN 4
> > > > +/* maximum valid value for a subnet ID in a subnet map leaf */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MAX_OFST 20
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_SUBNET_ID_MAX_LEN 4
> > > > +/* the number of entries in the local and remote port range maps */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_TREE_NUM_ENTRIES_OFST 24
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_TREE_NUM_ENTRIES_LEN 4
> > > > +/* minimum valid value for a portrange ID in a port range map leaf */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MIN_OFST 28
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MIN_LEN 4
> > > > +/* maximum valid value for a portrange ID in a port range map leaf */
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MAX_OFST 32
> > > > +#define MC_CMD_GET_PARSER_DISP_SECURITY_RULE_INFO_OUT_PORTRANGE_ID_MAX_LEN 4
> > > > +
> > > > /* MC_CMD_GET_PARSER_DISP_VNIC_ENCAP_MATCHES_OUT msgresponse: This response is
> > > > * returned if a MC_CMD_GET_PARSER_DISP_INFO_IN request is sent with OP value
> > > > * OP_GET_SUPPORTED_VNIC_ENCAP_MATCHES. It contains information about the
> > > > @@ -13716,7 +14586,7 @@
> > > > #define MC_CMD_SATELLITE_DOWNLOAD 0x91
> > > > #undef MC_CMD_0x91_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x91_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x91_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_SATELLITE_DOWNLOAD_IN msgrequest: The reset requirements for the CPUs
> > > > * are subtle, and so downloads must proceed in a number of phases.
> > > > @@ -13835,10 +14705,9 @@
> > > >
> > > > /***********************************/
> > > > /* MC_CMD_GET_CAPABILITIES
> > > > - * Get device capabilities.
> > > > - *
> > > > - * This is supplementary to the MC_CMD_GET_BOARD_CFG command, and intended to
> > > > - * reference inherent device capabilities as opposed to current NVRAM config.
> > > > + * Get device capabilities. This is supplementary to the MC_CMD_GET_BOARD_CFG
> > > > + * command, and intended to reference inherent device capabilities as opposed
> > > > + * to current NVRAM config.
> > > > */
> > > > #define MC_CMD_GET_CAPABILITIES 0xbe
> > > > #undef MC_CMD_0xbe_PRIVILEGE_CTG
> > > > @@ -16796,9 +17665,15 @@
> > > > #define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
> > > > #define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
> > > > #define MC_CMD_GET_CAPABILITIES_V7_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
> > > > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
> > > > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
> > > > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
> > > > #define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
> > > > #define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
> > > > #define MC_CMD_GET_CAPABILITIES_V7_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
> > > > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_OFST 148
> > > > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_LBN 15
> > > > +#define MC_CMD_GET_CAPABILITIES_V7_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
> > > >
> > > > /* MC_CMD_GET_CAPABILITIES_V8_OUT msgresponse */
> > > > #define MC_CMD_GET_CAPABILITIES_V8_OUT_LEN 160
> > > > @@ -17300,9 +18175,15 @@
> > > > #define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
> > > > #define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
> > > > #define MC_CMD_GET_CAPABILITIES_V8_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
> > > > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
> > > > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
> > > > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
> > > > #define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
> > > > #define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
> > > > #define MC_CMD_GET_CAPABILITIES_V8_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
> > > > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_OFST 148
> > > > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_LBN 15
> > > > +#define MC_CMD_GET_CAPABILITIES_V8_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
> > > > /* These bits are reserved for communicating test-specific capabilities to
> > > > * host-side test software. All production drivers should treat this field as
> > > > * opaque.
> > > > @@ -17818,9 +18699,15 @@
> > > > #define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
> > > > #define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
> > > > #define MC_CMD_GET_CAPABILITIES_V9_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
> > > > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
> > > > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
> > > > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
> > > > #define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
> > > > #define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
> > > > #define MC_CMD_GET_CAPABILITIES_V9_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
> > > > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_OFST 148
> > > > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_LBN 15
> > > > +#define MC_CMD_GET_CAPABILITIES_V9_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
> > > > /* These bits are reserved for communicating test-specific capabilities to
> > > > * host-side test software. All production drivers should treat this field as
> > > > * opaque.
> > > > @@ -18371,9 +19258,15 @@
> > > > #define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_OFST 148
> > > > #define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_LBN 12
> > > > #define MC_CMD_GET_CAPABILITIES_V10_OUT_RSS_STEER_ON_OUTER_SUPPORTED_WIDTH 1
> > > > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_OFST 148
> > > > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_LBN 13
> > > > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_MAE_ACTION_SET_ALLOC_V3_SUPPORTED_WIDTH 1
> > > > #define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_OFST 148
> > > > #define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_LBN 14
> > > > #define MC_CMD_GET_CAPABILITIES_V10_OUT_DYNAMIC_MPORT_JOURNAL_WIDTH 1
> > > > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_OFST 148
> > > > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_LBN 15
> > > > +#define MC_CMD_GET_CAPABILITIES_V10_OUT_CLIENT_CMD_VF_PROXY_WIDTH 1
> > > > /* These bits are reserved for communicating test-specific capabilities to
> > > > * host-side test software. All production drivers should treat this field as
> > > > * opaque.
> > > > @@ -18468,6 +19361,13 @@
> > > > * are not defined.
> > > > */
> > > > #define MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_TSA 0x1
> > > > +/* enum: MCDI command used for platform management. Typically, these commands
> > > > + * are used for low-level operations directed at the platform as a whole (e.g.
> > > > + * MMIO device enumeration) rather than individual functions and use a
> > > > + * dedicated comms channel (e.g. RPmsg/IPI). May be handled by the same or
> > > > + * different CPU as MCDI_MESSAGE_TYPE_MC.
> > > > + */
> > > > +#define MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_PLATFORM 0x2
> > > >
> > > >
> > > > /***********************************/
> > > > @@ -20179,7 +21079,7 @@
> > > > #define MC_CMD_SHMBOOT_OP 0xe6
> > > > #undef MC_CMD_0xe6_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0xe6_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0xe6_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_SHMBOOT_OP_IN msgrequest */
> > > > #define MC_CMD_SHMBOOT_OP_IN_LEN 4
> > > > @@ -20448,7 +21348,7 @@
> > > > #define MC_CMD_ENABLE_OFFLINE_BIST 0xed
> > > > #undef MC_CMD_0xed_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0xed_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0xed_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_ENABLE_OFFLINE_BIST_IN msgrequest */
> > > > #define MC_CMD_ENABLE_OFFLINE_BIST_IN_LEN 0
> > > > @@ -20588,7 +21488,7 @@
> > > > #define MC_CMD_KR_TUNE 0xf1
> > > > #undef MC_CMD_0xf1_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0xf1_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0xf1_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_KR_TUNE_IN msgrequest */
> > > > #define MC_CMD_KR_TUNE_IN_LENMIN 4
> > > > @@ -21144,7 +22044,7 @@
> > > > #define MC_CMD_PCIE_TUNE 0xf2
> > > > #undef MC_CMD_0xf2_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0xf2_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0xf2_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_PCIE_TUNE_IN msgrequest */
> > > > #define MC_CMD_PCIE_TUNE_IN_LENMIN 4
> > > > @@ -21877,7 +22777,7 @@
> > > > #define MC_CMD_LICENSING_V3_TEMPORARY 0xd6
> > > > #undef MC_CMD_0xd6_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0xd6_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0xd6_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_LICENSING_V3_TEMPORARY_IN msgrequest */
> > > > #define MC_CMD_LICENSING_V3_TEMPORARY_IN_LEN 4
> > > > @@ -22305,8 +23205,8 @@
> > > > * TLV_PORT_MODE_*). A superset of MC_CMD_GET_PORT_MODES_OUT/MODES that
> > > > * contains all modes implemented in firmware for a particular board. Modes
> > > > * listed in MODES are considered production modes and should be exposed in
> > > > - * userland tools. Modes listed in ENGINEERING_MODES, but not in MODES
> > > > - * should be considered hidden (not to be exposed in userland tools) and for
> > > > + * userland tools. Modes listed in ENGINEERING_MODES, but not in MODES should
> > > > + * be considered hidden (not to be exposed in userland tools) and for
> > > > * engineering use only. There are no other semantic differences and any mode
> > > > * listed in either MODES or ENGINEERING_MODES can be set on the board.
> > > > */
> > > > @@ -22937,7 +23837,7 @@
> > > > #define MC_CMD_EXEC_SIGNED 0x10c
> > > > #undef MC_CMD_0x10c_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x10c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x10c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_EXEC_SIGNED_IN msgrequest */
> > > > #define MC_CMD_EXEC_SIGNED_IN_LEN 28
> > > > @@ -22967,7 +23867,7 @@
> > > > #define MC_CMD_PREPARE_SIGNED 0x10d
> > > > #undef MC_CMD_0x10d_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x10d_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x10d_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_PREPARE_SIGNED_IN msgrequest */
> > > > #define MC_CMD_PREPARE_SIGNED_IN_LEN 4
> > > > @@ -22979,6 +23879,445 @@
> > > > #define MC_CMD_PREPARE_SIGNED_OUT_LEN 0
> > > >
> > > >
> > > > +/***********************************/
> > > > +/* MC_CMD_SET_SECURITY_RULE
> > > > + * Set blacklist and/or whitelist action for a particular match criteria.
> > > > + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
> > > > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > > > + * been used in any released code and may change during development. This note
> > > > + * will be removed once it is regarded as stable.
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_RULE 0x10f
> > > > +#undef MC_CMD_0x10f_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x10f_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_SET_SECURITY_RULE_IN msgrequest */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_LEN 92
> > > > +/* fields to include in match criteria */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_FIELDS_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_FIELDS_LEN 4
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_LBN 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_IP_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_LBN 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_IP_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_LBN 2
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_MAC_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_LBN 3
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORT_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_LBN 4
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_MAC_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_LBN 5
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORT_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_LBN 6
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_ETHER_TYPE_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_LBN 7
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_INNER_VLAN_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_LBN 8
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_OUTER_VLAN_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_LBN 9
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_IP_PROTO_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_LBN 10
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_PHYSICAL_PORT_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_LBN 11
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_RESERVED_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_LBN 12
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_SUBNET_ID_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_LBN 13
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_REMOTE_PORTRANGE_ID_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_LBN 14
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_MATCH_LOCAL_PORTRANGE_ID_WIDTH 1
> > > > +/* remote MAC address to match (as bytes in network order) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_MAC_OFST 4
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_MAC_LEN 6
> > > > +/* remote port to match (as bytes in network order) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORT_OFST 10
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORT_LEN 2
> > > > +/* local MAC address to match (as bytes in network order) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_MAC_OFST 12
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_MAC_LEN 6
> > > > +/* local port to match (as bytes in network order) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORT_OFST 18
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORT_LEN 2
> > > > +/* Ethernet type to match (as bytes in network order) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_ETHER_TYPE_OFST 20
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_ETHER_TYPE_LEN 2
> > > > +/* Inner VLAN tag to match (as bytes in network order) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_INNER_VLAN_OFST 22
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_INNER_VLAN_LEN 2
> > > > +/* Outer VLAN tag to match (as bytes in network order) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_OUTER_VLAN_OFST 24
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_OUTER_VLAN_LEN 2
> > > > +/* IP protocol to match (in low byte; set high byte to 0) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_IP_PROTO_OFST 26
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_IP_PROTO_LEN 2
> > > > +/* Physical port to match (as little-endian 32-bit value) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_PHYSICAL_PORT_OFST 28
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_PHYSICAL_PORT_LEN 4
> > > > +/* Reserved; set to 0 */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_RESERVED_OFST 32
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_RESERVED_LEN 4
> > > > +/* remote IP address to match (as bytes in network order; set last 12 bytes to
> > > > + * 0 for IPv4 address)
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_IP_OFST 36
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_IP_LEN 16
> > > > +/* local IP address to match (as bytes in network order; set last 12 bytes to 0
> > > > + * for IPv4 address)
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_IP_OFST 52
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_IP_LEN 16
> > > > +/* remote subnet ID to match (as little-endian 32-bit value); note that remote
> > > > + * subnets are matched by mapping the remote IP address to a "subnet ID" via a
> > > > + * data structure which must already have been configured using
> > > > + * MC_CMD_SUBNET_MAP_SET_NODE appropriately
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_SUBNET_ID_OFST 68
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_SUBNET_ID_LEN 4
> > > > +/* remote portrange ID to match (as little-endian 32-bit value); note that
> > > > + * remote port ranges are matched by mapping the remote port to a "portrange
> > > > + * ID" via a data structure which must already have been configured using
> > > > + * MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORTRANGE_ID_OFST 72
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_REMOTE_PORTRANGE_ID_LEN 4
> > > > +/* local portrange ID to match (as little-endian 32-bit value); note that local
> > > > + * port ranges are matched by mapping the local port to a "portrange ID" via a
> > > > + * data structure which must already have been configured using
> > > > + * MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORTRANGE_ID_OFST 76
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_LOCAL_PORTRANGE_ID_LEN 4
> > > > +/* set the action for transmitted packets matching this rule */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_OFST 80
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_LEN 4
> > > > +/* enum: make no decision */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_NONE 0x0
> > > > +/* enum: decide to accept the packet */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_WHITELIST 0x1
> > > > +/* enum: decide to drop the packet */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_BLACKLIST 0x2
> > > > +/* enum: inform the TSA controller about some sample of packets matching this
> > > > + * rule (via MC_CMD_TSA_INFO_IN_PKT_SAMPLE messages); may be bitwise-ORed with
> > > > + * either the WHITELIST or BLACKLIST action
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_SAMPLE 0x4
> > > > +/* enum: do not change the current TX action */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_TX_ACTION_UNCHANGED 0xffffffff
> > > > +/* set the action for received packets matching this rule */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_OFST 84
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_LEN 4
> > > > +/* enum: make no decision */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_NONE 0x0
> > > > +/* enum: decide to accept the packet */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_WHITELIST 0x1
> > > > +/* enum: decide to drop the packet */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_BLACKLIST 0x2
> > > > +/* enum: inform the TSA controller about some sample of packets matching this
> > > > + * rule (via MC_CMD_TSA_INFO_IN_PKT_SAMPLE messages); may be bitwise-ORed with
> > > > + * either the WHITELIST or BLACKLIST action
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_SAMPLE 0x4
> > > > +/* enum: do not change the current RX action */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_RX_ACTION_UNCHANGED 0xffffffff
> > > > +/* counter ID to associate with this rule; IDs are allocated using
> > > > + * MC_CMD_SECURITY_RULE_COUNTER_ALLOC
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_OFST 88
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_LEN 4
> > > > +/* enum: special value for the null counter ID */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_NONE 0x0
> > > > +/* enum: special value to tell the MC to allocate an available counter */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_SW_AUTO 0xeeeeeeee
> > > > +/* enum: special value to request use of hardware counter (Medford2 only) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_IN_COUNTER_ID_HW 0xffffffff
> > > > +
> > > > +/* MC_CMD_SET_SECURITY_RULE_OUT msgresponse */
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_LEN 32
> > > > +/* new reference count for uses of counter ID */
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_REFCNT_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_REFCNT_LEN 4
> > > > +/* constructed match bits for this rule (as a tracing aid only) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_MATCH_BITS_OFST 4
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_MATCH_BITS_LEN 12
> > > > +/* constructed discriminator bits for this rule (as a tracing aid only) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_DISCRIMINATOR_OFST 16
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_DISCRIMINATOR_LEN 4
> > > > +/* base location for probes for this rule (as a tracing aid only) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_BASE_OFST 20
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_BASE_LEN 4
> > > > +/* step for probes for this rule (as a tracing aid only) */
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_STEP_OFST 24
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_LUE_PROBE_STEP_LEN 4
> > > > +/* ID for reading back the counter */
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_ID_OFST 28
> > > > +#define MC_CMD_SET_SECURITY_RULE_OUT_COUNTER_ID_LEN 4
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_RESET_SECURITY_RULES
> > > > + * Reset all blacklist and whitelist actions for a particular physical port, or
> > > > + * all ports. (Medford-only; for use by SolarSecure apps, not directly by
> > > > + * drivers. See SF-114946-SW.) NOTE - this message definition is provisional.
> > > > + * It has not yet been used in any released code and may change during
> > > > + * development. This note will be removed once it is regarded as stable.
> > > > + */
> > > > +#define MC_CMD_RESET_SECURITY_RULES 0x110
> > > > +#undef MC_CMD_0x110_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x110_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_RESET_SECURITY_RULES_IN msgrequest */
> > > > +#define MC_CMD_RESET_SECURITY_RULES_IN_LEN 4
> > > > +/* index of physical port to reset (or ALL_PHYSICAL_PORTS to reset all) */
> > > > +#define MC_CMD_RESET_SECURITY_RULES_IN_PHYSICAL_PORT_OFST 0
> > > > +#define MC_CMD_RESET_SECURITY_RULES_IN_PHYSICAL_PORT_LEN 4
> > > > +/* enum: special value to reset all physical ports */
> > > > +#define MC_CMD_RESET_SECURITY_RULES_IN_ALL_PHYSICAL_PORTS 0xffffffff
> > > > +
> > > > +/* MC_CMD_RESET_SECURITY_RULES_OUT msgresponse */
> > > > +#define MC_CMD_RESET_SECURITY_RULES_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_GET_SECURITY_RULESET_VERSION
> > > > + * Return a large hash value representing a "version" of the complete set of
> > > > + * currently active blacklist / whitelist rules and associated data structures.
> > > > + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
> > > > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > > > + * been used in any released code and may change during development. This note
> > > > + * will be removed once it is regarded as stable.
> > > > + */
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION 0x111
> > > > +#undef MC_CMD_0x111_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x111_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_GET_SECURITY_RULESET_VERSION_IN msgrequest */
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_IN_LEN 0
> > > > +
> > > > +/* MC_CMD_GET_SECURITY_RULESET_VERSION_OUT msgresponse */
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMIN 1
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMAX 252
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_LEN(num) (0+1*(num))
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_NUM(len) (((len)-0)/1)
> > > > +/* Opaque hash value; length may vary depending on the hash scheme used */
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_OFST 0
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_LEN 1
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MINNUM 1
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MAXNUM 252
> > > > +#define MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION_MAXNUM_MCDI2 1020
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC
> > > > + * Allocate counters for use with blacklist / whitelist rules. (Medford-only;
> > > > + * for use by SolarSecure apps, not directly by drivers. See SF-114946-SW.)
> > > > + * NOTE - this message definition is provisional. It has not yet been used in
> > > > + * any released code and may change during development. This note will be
> > > > + * removed once it is regarded as stable.
> > > > + */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC 0x112
> > > > +#undef MC_CMD_0x112_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x112_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN msgrequest */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_LEN 4
> > > > +/* the number of new counter IDs to request */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_NUM_COUNTERS_OFST 0
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_IN_NUM_COUNTERS_LEN 4
> > > > +
> > > > +/* MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT msgresponse */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMIN 4
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMAX 252
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_LEN(num) (4+4*(num))
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_NUM(len) (((len)-4)/4)
> > > > +/* the number of new counter IDs allocated (may be less than the number
> > > > + * requested if resources are unavailable)
> > > > + */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_NUM_COUNTERS_OFST 0
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_NUM_COUNTERS_LEN 4
> > > > +/* new counter ID(s) */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_OFST 4
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_LEN 4
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MINNUM 0
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM 62
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM_MCDI2 254
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_SECURITY_RULE_COUNTER_FREE
> > > > + * Allocate counters for use with blacklist / whitelist rules. (Medford-only;
> > > > + * for use by SolarSecure apps, not directly by drivers. See SF-114946-SW.)
> > > > + * NOTE - this message definition is provisional. It has not yet been used in
> > > > + * any released code and may change during development. This note will be
> > > > + * removed once it is regarded as stable.
> > > > + */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE 0x113
> > > > +#undef MC_CMD_0x113_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x113_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_SECURITY_RULE_COUNTER_FREE_IN msgrequest */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMIN 4
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMAX 252
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_LEN(num) (4+4*(num))
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_NUM(len) (((len)-4)/4)
> > > > +/* the number of counter IDs to free */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_NUM_COUNTERS_OFST 0
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_NUM_COUNTERS_LEN 4
> > > > +/* the counter ID(s) to free */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_OFST 4
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_LEN 4
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MINNUM 0
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MAXNUM 62
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_IN_COUNTER_ID_MAXNUM_MCDI2 254
> > > > +
> > > > +/* MC_CMD_SECURITY_RULE_COUNTER_FREE_OUT msgresponse */
> > > > +#define MC_CMD_SECURITY_RULE_COUNTER_FREE_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_SUBNET_MAP_SET_NODE
> > > > + * Atomically update a trie node in the map of subnets to subnet IDs. The
> > > > + * constants in the descriptions of the fields of this message may be retrieved
> > > > + * by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO. (Medford-
> > > > + * only; for use by SolarSecure apps, not directly by drivers. See
> > > > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > > > + * been used in any released code and may change during development. This note
> > > > + * will be removed once it is regarded as stable.
> > > > + */
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE 0x114
> > > > +#undef MC_CMD_0x114_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x114_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_SUBNET_MAP_SET_NODE_IN msgrequest */
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMIN 6
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMAX 252
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_LEN(num) (4+2*(num))
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_NUM(len) (((len)-4)/2)
> > > > +/* node to update in the range 0 .. SUBNET_MAP_NUM_NODES-1 */
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_NODE_ID_OFST 0
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_NODE_ID_LEN 4
> > > > +/* SUBNET_MAP_NUM_ENTRIES_PER_NODE new entries; each entry is either a pointer
> > > > + * to the next node, expressed as an offset in the trie memory (i.e. node ID
> > > > + * multiplied by SUBNET_MAP_NUM_ENTRIES_PER_NODE), or a leaf value in the range
> > > > + * SUBNET_ID_MIN .. SUBNET_ID_MAX
> > > > + */
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_OFST 4
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_LEN 2
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MINNUM 1
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MAXNUM 124
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_IN_ENTRY_MAXNUM_MCDI2 508
> > > > +
> > > > +/* MC_CMD_SUBNET_MAP_SET_NODE_OUT msgresponse */
> > > > +#define MC_CMD_SUBNET_MAP_SET_NODE_OUT_LEN 0
> > > > +
> > > > +/* PORTRANGE_TREE_ENTRY structuredef */
> > > > +#define PORTRANGE_TREE_ENTRY_LEN 4
> > > > +/* key for branch nodes (<= key takes left branch, > key takes right branch),
> > > > + * or magic value for leaf nodes
> > > > + */
> > > > +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_OFST 0
> > > > +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_LEN 2
> > > > +#define PORTRANGE_TREE_ENTRY_LEAF_NODE_KEY 0xffff /* enum */
> > > > +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_LBN 0
> > > > +#define PORTRANGE_TREE_ENTRY_BRANCH_KEY_WIDTH 16
> > > > +/* final portrange ID for leaf nodes (don't care for branch nodes) */
> > > > +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_OFST 2
> > > > +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_LEN 2
> > > > +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_LBN 16
> > > > +#define PORTRANGE_TREE_ENTRY_LEAF_PORTRANGE_ID_WIDTH 16
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE
> > > > + * Atomically update the entire tree mapping remote port ranges to portrange
> > > > + * IDs. The constants in the descriptions of the fields of this message may be
> > > > + * retrieved by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO.
> > > > + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
> > > > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > > > + * been used in any released code and may change during development. This note
> > > > + * will be removed once it is regarded as stable.
> > > > + */
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE 0x115
> > > > +#undef MC_CMD_0x115_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x115_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN msgrequest */
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMIN 4
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMAX 252
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_LEN(num) (0+4*(num))
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_NUM(len) (((len)-0)/4)
> > > > +/* PORTRANGE_TREE_NUM_ENTRIES new entries, each laid out as a
> > > > + * PORTRANGE_TREE_ENTRY
> > > > + */
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_OFST 0
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_LEN 4
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MINNUM 1
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM 63
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM_MCDI2 255
> > > > +
> > > > +/* MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_OUT msgresponse */
> > > > +#define MC_CMD_REMOTE_PORTRANGE_MAP_SET_TREE_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE
> > > > + * Atomically update the entire tree mapping remote port ranges to portrange
> > > > + * IDs. The constants in the descriptions of the fields of this message may be
> > > > + * retrieved by the GET_SECURITY_RULE_INFO op of MC_CMD_GET_PARSER_DISP_INFO.
> > > > + * (Medford-only; for use by SolarSecure apps, not directly by drivers. See
> > > > + * SF-114946-SW.) NOTE - this message definition is provisional. It has not yet
> > > > + * been used in any released code and may change during development. This note
> > > > + * will be removed once it is regarded as stable.
> > > > + */
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE 0x116
> > > > +#undef MC_CMD_0x116_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x116_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN msgrequest */
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMIN 4
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMAX 252
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_LEN(num) (0+4*(num))
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_NUM(len) (((len)-0)/4)
> > > > +/* PORTRANGE_TREE_NUM_ENTRIES new entries, each laid out as a
> > > > + * PORTRANGE_TREE_ENTRY
> > > > + */
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_OFST 0
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_LEN 4
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MINNUM 1
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM 63
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_IN_ENTRIES_MAXNUM_MCDI2 255
> > > > +
> > > > +/* MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_OUT msgresponse */
> > > > +#define MC_CMD_LOCAL_PORTRANGE_MAP_SET_TREE_OUT_LEN 0
> > > > +
> > > > /* TUNNEL_ENCAP_UDP_PORT_ENTRY structuredef */
> > > > #define TUNNEL_ENCAP_UDP_PORT_ENTRY_LEN 4
> > > > /* UDP port (the standard ports are named below but any port may be used) */
> > > > @@ -23058,7 +24397,7 @@
> > > > #define MC_CMD_RX_BALANCING 0x118
> > > > #undef MC_CMD_0x118_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x118_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x118_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_RX_BALANCING_IN msgrequest */
> > > > #define MC_CMD_RX_BALANCING_IN_LEN 16
> > > > @@ -23079,6 +24418,627 @@
> > > > #define MC_CMD_RX_BALANCING_OUT_LEN 0
> > > >
> > > >
> > > > +/***********************************/
> > > > +/* MC_CMD_TSA_BIND
> > > > + * TSAN - TSAC binding communication protocol. Refer to SF-115479-TC for more
> > > > + * info in respect to the binding protocol.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND 0x119
> > > > +#undef MC_CMD_0x119_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x119_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN msgrequest: Protocol operation code */
> > > > +#define MC_CMD_TSA_BIND_IN_LEN 4
> > > > +#define MC_CMD_TSA_BIND_IN_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_OP_LEN 4
> > > > +/* enum: Obsolete. Use MC_CMD_SECURE_NIC_INFO_IN_STATUS. */
> > > > +#define MC_CMD_TSA_BIND_OP_GET_ID 0x1
> > > > +/* enum: Get a binding ticket from the TSAN. The binding ticket is used as part
> > > > + * of the binding procedure to authorize the binding of an adapter to a TSAID.
> > > > + * Refer to SF-114946-SW for more information. This sub-command is only
> > > > + * available over a TLS secure connection between the TSAN and TSAC.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OP_GET_TICKET 0x2
> > > > +/* enum: Opcode associated with the propagation of a private key that TSAN uses
> > > > + * as part of post-binding authentication procedure. More specifically, TSAN
> > > > + * uses this key for a signing operation. TSAC uses the counterpart public key
> > > > + * to verify the signature. Note - The post-binding authentication occurs when
> > > > + * the TSAN-TSAC connection terminates and TSAN tries to reconnect. Refer to
> > > > + * SF-114946-SW for more information. This sub-command is only available over a
> > > > + * TLS secure connection between the TSAN and TSAC.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OP_SET_KEY 0x3
> > > > +/* enum: Request an insecure unbinding operation. This sub-command is available
> > > > + * for any privileged client.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OP_UNBIND 0x4
> > > > +/* enum: Obsolete. Use MC_CMD_TSA_BIND_OP_SECURE_UNBIND. */
> > > > +#define MC_CMD_TSA_BIND_OP_UNBIND_EXT 0x5
> > > > +/* enum: Opcode associated with the propagation of the unbinding secret token.
> > > > + * TSAN persists the unbinding secret token. Refer to SF-115479-TC for more
> > > > + * information. This sub-command is only available over a TLS secure connection
> > > > + * between the TSAN and TSAC.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OP_SET_UNBINDTOKEN 0x6
> > > > +/* enum: Obsolete. Use MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION. */
> > > > +#define MC_CMD_TSA_BIND_OP_DECOMMISSION 0x7
> > > > +/* enum: Obsolete. Use MC_CMD_GET_CERTIFICATE. */
> > > > +#define MC_CMD_TSA_BIND_OP_GET_CERTIFICATE 0x8
> > > > +/* enum: Request a secure unbinding operation using unbinding token. This sub-
> > > > + * command is available for any privileged client.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OP_SECURE_UNBIND 0x9
> > > > +/* enum: Request a secure decommissioning operation. This sub-command is
> > > > + * available for any privileged client.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION 0xa
> > > > +/* enum: Test facility that allows an adapter to be configured to behave as if
> > > > + * Bound to a TSA controller with restricted MCDI administrator operations.
> > > > + * This operation is primarily intended to aid host driver development.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OP_TEST_MCDI 0xb
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_GET_ID msgrequest: Obsolete. Use
> > > > + * MC_CMD_SECURE_NIC_INFO_IN_STATUS.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_GET_ID_LEN 20
> > > > +/* The operation requested. */
> > > > +#define MC_CMD_TSA_BIND_IN_GET_ID_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_GET_ID_OP_LEN 4
> > > > +/* Cryptographic nonce that TSAC generates and sends to TSAN. TSAC generates
> > > > + * the nonce every time as part of the TSAN post-binding authentication
> > > > + * procedure when the TSAN-TSAC connection terminates and TSAN does need to re-
> > > > + * connect to the TSAC. Refer to SF-114946-SW for more information.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_GET_ID_NONCE_OFST 4
> > > > +#define MC_CMD_TSA_BIND_IN_GET_ID_NONCE_LEN 16
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_GET_TICKET msgrequest */
> > > > +#define MC_CMD_TSA_BIND_IN_GET_TICKET_LEN 4
> > > > +/* The operation requested. */
> > > > +#define MC_CMD_TSA_BIND_IN_GET_TICKET_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_GET_TICKET_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_SET_KEY msgrequest */
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMIN 5
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMAX 252
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_LEN(num) (4+1*(num))
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_NUM(len) (((len)-4)/1)
> > > > +/* The operation requested. */
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_OP_LEN 4
> > > > +/* This data blob contains the private key generated by the TSAC. TSAN uses
> > > > + * this key for a signing operation. Note- This private key is used in
> > > > + * conjunction with the post-binding TSAN authentication procedure that occurs
> > > > + * when the TSAN-TSAC connection terminates and TSAN tries to reconnect. Refer
> > > > + * to SF-114946-SW for more information.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_OFST 4
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MINNUM 1
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MAXNUM 248
> > > > +#define MC_CMD_TSA_BIND_IN_SET_KEY_DATKEY_MAXNUM_MCDI2 1016
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_UNBIND msgrequest: Request an insecure unbinding
> > > > + * operation.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_LEN 10
> > > > +/* The operation requested. */
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_OP_LEN 4
> > > > +/* TSAN unique identifier for the network adapter */
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_OFST 4
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_TSANID_LEN 6
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_UNBIND_EXT msgrequest: Obsolete. Use
> > > > + * MC_CMD_TSA_BIND_IN_SECURE_UNBIND.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMIN 93
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMAX 252
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_LEN(num) (92+1*(num))
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_NUM(len) (((len)-92)/1)
> > > > +/* The operation requested. */
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_OP_LEN 4
> > > > +/* TSAN unique identifier for the network adapter */
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_OFST 4
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_LEN 6
> > > > +/* Align the arguments to 32 bits */
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_RSVD_OFST 10
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSANID_RSVD_LEN 2
> > > > +/* This attribute identifies the TSA infrastructure domain. The length of the
> > > > + * TSAID attribute is limited to 64 bytes. This is how TSA SDK defines the max
> > > > + * length. Note- The TSAID is the Organizational Unit Name filed as part of the
> > > > + * root and server certificates.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_OFST 12
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_TSAID_NUM 64
> > > > +/* Unbinding secret token. The adapter validates this unbinding token by
> > > > + * comparing it against the one stored on the adapter as part of the
> > > > + * MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest. Refer to SF-115479-TC for
> > > > + * more information.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_UNBINDTOKEN_OFST 76
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_UNBINDTOKEN_LEN 16
> > > > +/* This is the signature of the above mentioned fields- TSANID, TSAID and
> > > > + * UNBINDTOKEN. As per current requirements, the SIG opaque data blob contains
> > > > + * ECDSA ECC-384 based signature. The ECC curve is secp384r1. The signature is
> > > > + * also ASN-1 encoded. Note- The signature is verified based on the public key
> > > > + * stored into the root certificate that is provisioned on the adapter side.
> > > > + * This key is known as the PUKtsaid. Refer to SF-115479-TC for more
> > > > + * information.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_OFST 92
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MINNUM 1
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MAXNUM 160
> > > > +#define MC_CMD_TSA_BIND_IN_UNBIND_EXT_SIG_MAXNUM_MCDI2 928
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest */
> > > > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_LEN 20
> > > > +/* The operation requested. */
> > > > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_OP_LEN 4
> > > > +/* Unbinding secret token. TSAN persists the unbinding secret token. Refer to
> > > > + * SF-115479-TC for more information.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_UNBINDTOKEN_OFST 4
> > > > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_UNBINDTOKEN_LEN 16
> > > > +/* enum: There are situations when the binding process does not complete
> > > > + * successfully due to key, other attributes corruption at the database level
> > > > + * (Controller). Adapter can't connect to the controller anymore. To recover,
> > > > + * make usage of the decommission command that forces the adapter into
> > > > + * unbinding state.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN_ADAPTER_BINDING_FAILURE 0x1
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_DECOMMISSION msgrequest: Obsolete. Use
> > > > + * MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMIN 109
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMAX 252
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_LEN(num) (108+1*(num))
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_NUM(len) (((len)-108)/1)
> > > > +/* This is the signature of the above mentioned fields- TSAID, USER and REASON.
> > > > + * As per current requirements, the SIG opaque data blob contains ECDSA ECC-384
> > > > + * based signature. The ECC curve is secp384r1. The signature is also ASN-1
> > > > + * encoded . Note- The signature is verified based on the public key stored
> > > > + * into the root certificate that is provisioned on the adapter side. This key
> > > > + * is known as the PUKtsaid. Refer to SF-115479-TC for more information.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_OFST 108
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MINNUM 1
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MAXNUM 144
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_SIG_MAXNUM_MCDI2 912
> > > > +/* The operation requested. */
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_OP_LEN 4
> > > > +/* This attribute identifies the TSA infrastructure domain. The length of the
> > > > + * TSAID attribute is limited to 64 bytes. This is how TSA SDK defines the max
> > > > + * length. Note- The TSAID is the Organizational Unit Name filed as part of the
> > > > + * root and server certificates.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_OFST 4
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_TSAID_NUM 64
> > > > +/* User ID that comes, as an example, from the Controller. Note- The 33 byte
> > > > + * length of this attribute is max length of the linux user name plus null
> > > > + * character.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_OFST 68
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_NUM 33
> > > > +/* Align the arguments to 32 bits */
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_RSVD_OFST 101
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_USER_RSVD_LEN 3
> > > > +/* Reason of why decommissioning happens Note- The list of reasons, defined as
> > > > + * part of the enumeration below, can be extended.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_REASON_OFST 104
> > > > +#define MC_CMD_TSA_BIND_IN_DECOMMISSION_REASON_LEN 4
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_GET_CERTIFICATE msgrequest: Obsolete. Use
> > > > + * MC_CMD_GET_CERTIFICATE.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_LEN 8
> > > > +/* The operation requested, must be MC_CMD_TSA_BIND_OP_GET_CERTIFICATE. */
> > > > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_OP_LEN 4
> > > > +/* Type of the certificate to be retrieved. */
> > > > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_TYPE_OFST 4
> > > > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_TYPE_LEN 4
> > > > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_UNUSED 0x0 /* enum */
> > > > +/* enum: Adapter Authentication Certificate (AAC). The AAC is used by the
> > > > + * controller to verify the authenticity of the adapter.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_AAC 0x1
> > > > +/* enum: Adapter Authentication Signing Certificate (AASC). The AASC is used by
> > > > + * the controller to verify the validity of AAC.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_GET_CERTIFICATE_AASC 0x2
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_SECURE_UNBIND msgrequest: Request a secure unbinding
> > > > + * operation using unbinding token.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMIN 97
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMAX 200
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LENMAX_MCDI2 200
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_LEN(num) (96+1*(num))
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_NUM(len) (((len)-96)/1)
> > > > +/* The operation requested, must be MC_CMD_TSA_BIND_OP_SECURE_UNBIND. */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_OP_LEN 4
> > > > +/* Type of the message. (MESSAGE_TYPE_xxx) Must be
> > > > + * MESSAGE_TYPE_TSA_SECURE_UNBIND.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_MESSAGE_TYPE_OFST 4
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_MESSAGE_TYPE_LEN 4
> > > > +/* TSAN unique identifier for the network adapter */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_OFST 8
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_LEN 6
> > > > +/* Align the arguments to 32 bits */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_RSVD_OFST 14
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSANID_RSVD_LEN 2
> > > > +/* A NUL padded US-ASCII string identifying the TSA infrastructure domain. This
> > > > + * field is for information only, and not used by the firmware. Note- The TSAID
> > > > + * is the Organizational Unit Name field as part of the root and server
> > > > + * certificates.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_OFST 16
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_TSAID_NUM 64
> > > > +/* Unbinding secret token. The adapter validates this unbinding token by
> > > > + * comparing it against the one stored on the adapter as part of the
> > > > + * MC_CMD_TSA_BIND_IN_SET_UNBINDTOKEN msgrequest. Refer to SF-115479-TC for
> > > > + * more information.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_UNBINDTOKEN_OFST 80
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_UNBINDTOKEN_LEN 16
> > > > +/* The signature computed and encoded as specified by MESSAGE_TYPE. */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_OFST 96
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MINNUM 1
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MAXNUM 104
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_UNBIND_SIG_MAXNUM_MCDI2 104
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION msgrequest: Request a secure
> > > > + * decommissioning operation.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMIN 113
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMAX 216
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LENMAX_MCDI2 216
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_LEN(num) (112+1*(num))
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_NUM(len) (((len)-112)/1)
> > > > +/* The operation requested, must be MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION. */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_OP_LEN 4
> > > > +/* Type of the message. (MESSAGE_TYPE_xxx) Must be
> > > > + * MESSAGE_TYPE_SECURE_DECOMMISSION.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_MESSAGE_TYPE_OFST 4
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_MESSAGE_TYPE_LEN 4
> > > > +/* A NUL padded US-ASCII string identifying the TSA infrastructure domain. This
> > > > + * field is for information only, and not used by the firmware. Note- The TSAID
> > > > + * is the Organizational Unit Name field as part of the root and server
> > > > + * certificates.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_OFST 8
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_TSAID_NUM 64
> > > > +/* A NUL padded US-ASCII string containing user name of the creator of the
> > > > + * decommissioning ticket. This field is for information only, and not used by
> > > > + * the firmware.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_OFST 72
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_USER_NUM 36
> > > > +/* Reason of why decommissioning happens */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_REASON_OFST 108
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_REASON_LEN 4
> > > > +/* enum: There are situations when the binding process does not complete
> > > > + * successfully due to key, other attributes corruption at the database level
> > > > + * (Controller). Adapter can't connect to the controller anymore. To recover,
> > > > + * use the decommission command to force the adapter into unbound state.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_ADAPTER_BINDING_FAILURE 0x1
> > > > +/* The signature computed and encoded as specified by MESSAGE_TYPE. */
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_OFST 112
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_LEN 1
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MINNUM 1
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MAXNUM 104
> > > > +#define MC_CMD_TSA_BIND_IN_SECURE_DECOMMISSION_SIG_MAXNUM_MCDI2 104
> > > > +
> > > > +/* MC_CMD_TSA_BIND_IN_TEST_MCDI msgrequest: Test mode that emulates MCDI
> > > > + * interface restrictions of a bound adapter. This operation is intended for
> > > > + * test use on adapters that are not deployed and bound to a TSA Controller.
> > > > + * Using it on a Bound adapter will succeed but will not alter the MCDI
> > > > + * privileges as MCDI operations will already be restricted.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_LEN 8
> > > > +/* The operation requested must be MC_CMD_TSA_BIND_OP_TEST_MCDI. */
> > > > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_OP_LEN 4
> > > > +/* Enable or disable emulation of bound adapter */
> > > > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_CTRL_OFST 4
> > > > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_CTRL_LEN 4
> > > > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_DISABLE 0x0 /* enum */
> > > > +#define MC_CMD_TSA_BIND_IN_TEST_MCDI_ENABLE 0x1 /* enum */
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_GET_ID msgresponse: Obsolete. Use
> > > > + * MC_CMD_SECURE_NIC_INFO_OUT_STATUS.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMIN 15
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMAX 252
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_LEN(num) (14+1*(num))
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_NUM(len) (((len)-14)/1)
> > > > +/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_ID that is sent back to
> > > > + * the caller.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_OP_LEN 4
> > > > +/* Rules engine type. Note- The rules engine type allows TSAC to further
> > > > + * identify the connected endpoint (e.g. TSAN, NIC Emulator) type and take the
> > > > + * proper action accordingly. As an example, TSAC uses the rules engine type to
> > > > + * select the SF key that differs in the case of TSAN vs. NIC Emulator.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_OFST 4
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_LEN 4
> > > > +/* enum: Hardware rules engine. */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_TSAN 0x1
> > > > +/* enum: Nic emulator rules engine. */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_NEMU 0x2
> > > > +/* enum: SSFE. */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_RULE_ENGINE_SSFE 0x3
> > > > +/* TSAN unique identifier for the network adapter */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_OFST 8
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_TSANID_LEN 6
> > > > +/* The signature data blob. The signature is computed against the message
> > > > + * formed by TSAN ID concatenated with the NONCE value. Refer to SF-115479-TC
> > > > + * for more information also in respect to the private keys that are used to
> > > > + * sign the message based on TSAN pre/post-binding authentication procedure.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_OFST 14
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_LEN 1
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MINNUM 1
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM 238
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_ID_SIG_MAXNUM_MCDI2 1006
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_GET_TICKET msgresponse */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMIN 5
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMAX 252
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_LEN(num) (4+1*(num))
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_NUM(len) (((len)-4)/1)
> > > > +/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_TICKET that is sent back
> > > > + * to the caller.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_OP_LEN 4
> > > > +/* The ticket represents the data blob construct that TSAN sends to TSAC as
> > > > + * part of the binding protocol. From the TSAN perspective the ticket is an
> > > > + * opaque construct. For more info refer to SF-115479-TC.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_OFST 4
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_LEN 1
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MINNUM 1
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MAXNUM 248
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_TICKET_TICKET_MAXNUM_MCDI2 1016
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_SET_KEY msgresponse */
> > > > +#define MC_CMD_TSA_BIND_OUT_SET_KEY_LEN 4
> > > > +/* The protocol operation code MC_CMD_TSA_BIND_OP_SET_KEY that is sent back to
> > > > + * the caller.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_SET_KEY_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_SET_KEY_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_UNBIND msgresponse: Response to insecure unbind request.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_LEN 8
> > > > +/* Same as MC_CMD_ERR field, but included as 0 in success cases */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_RESULT_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_RESULT_LEN 4
> > > > +/* Extra status information */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_INFO_OFST 4
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_INFO_LEN 4
> > > > +/* enum: Unbind successful. */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_OK_UNBOUND 0x0
> > > > +/* enum: TSANID mismatch */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_BAD_TSANID 0x1
> > > > +/* enum: Unable to remove the binding ticket from persistent storage. */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_REMOVE_TICKET 0x2
> > > > +/* enum: TSAN is not bound to a binding ticket. */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_ERR_NOT_BOUND 0x3
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_UNBIND_EXT msgresponse: Obsolete. Use
> > > > + * MC_CMD_TSA_BIND_OUT_SECURE_UNBIND.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_LEN 8
> > > > +/* Same as MC_CMD_ERR field, but included as 0 in success cases */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_RESULT_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_RESULT_LEN 4
> > > > +/* Extra status information */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_INFO_OFST 4
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_INFO_LEN 4
> > > > +/* enum: Unbind successful. */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_OK_UNBOUND 0x0
> > > > +/* enum: TSANID mismatch */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_TSANID 0x1
> > > > +/* enum: Unable to remove the binding ticket from persistent storage. */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_REMOVE_TICKET 0x2
> > > > +/* enum: TSAN is not bound to a binding ticket. */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_NOT_BOUND 0x3
> > > > +/* enum: Invalid unbind token */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_TOKEN 0x4
> > > > +/* enum: Invalid signature */
> > > > +#define MC_CMD_TSA_BIND_OUT_UNBIND_EXT_ERR_BAD_SIGNATURE 0x5
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN msgresponse */
> > > > +#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_LEN 4
> > > > +/* The protocol operation code MC_CMD_TSA_BIND_OP_SET_UNBINDTOKEN that is sent
> > > > + * back to the caller.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_SET_UNBINDTOKEN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_DECOMMISSION msgresponse: Obsolete. Use
> > > > + * MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_LEN 4
> > > > +/* The protocol operation code MC_CMD_TSA_BIND_OP_DECOMMISSION that is sent
> > > > + * back to the caller.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_DECOMMISSION_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE msgresponse */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMIN 9
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMAX 252
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_LEN(num) (8+1*(num))
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_NUM(len) (((len)-8)/1)
> > > > +/* The protocol operation code MC_CMD_TSA_BIND_OP_GET_CERTIFICATE that is sent
> > > > + * back to the caller.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_OP_LEN 4
> > > > +/* Type of the certificate. */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_TYPE_OFST 4
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_TYPE_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MC_CMD_TSA_BIND_IN_GET_CERTIFICATE/TYPE */
> > > > +/* The certificate data. */
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_OFST 8
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_LEN 1
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MINNUM 1
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MAXNUM 244
> > > > +#define MC_CMD_TSA_BIND_OUT_GET_CERTIFICATE_DATA_MAXNUM_MCDI2 1012
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_SECURE_UNBIND msgresponse: Response to secure unbind
> > > > + * request.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_LEN 8
> > > > +/* The protocol operation code that is sent back to the caller. */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OP_LEN 4
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_RESULT_OFST 4
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_RESULT_LEN 4
> > > > +/* enum: Unbind successful. */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_OK_UNBOUND 0x0
> > > > +/* enum: TSANID mismatch */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_TSANID 0x1
> > > > +/* enum: Unable to remove the binding ticket from persistent storage. */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_REMOVE_TICKET 0x2
> > > > +/* enum: TSAN is not bound to a domain. */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_NOT_BOUND 0x3
> > > > +/* enum: Invalid unbind token */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_TOKEN 0x4
> > > > +/* enum: Invalid signature */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_UNBIND_ERR_BAD_SIGNATURE 0x5
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION msgresponse: Response to secure
> > > > + * decommission request.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_LEN 8
> > > > +/* The protocol operation code that is sent back to the caller. */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OP_LEN 4
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_RESULT_OFST 4
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_RESULT_LEN 4
> > > > +/* enum: Unbind successful. */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_OK_UNBOUND 0x0
> > > > +/* enum: TSANID mismatch */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_TSANID 0x1
> > > > +/* enum: Unable to remove the binding ticket from persistent storage. */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_REMOVE_TICKET 0x2
> > > > +/* enum: TSAN is not bound to a domain. */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_NOT_BOUND 0x3
> > > > +/* enum: Invalid unbind token */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_TOKEN 0x4
> > > > +/* enum: Invalid signature */
> > > > +#define MC_CMD_TSA_BIND_OUT_SECURE_DECOMMISSION_ERR_BAD_SIGNATURE 0x5
> > > > +
> > > > +/* MC_CMD_TSA_BIND_OUT_TEST_MCDI msgrequest */
> > > > +#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_LEN 4
> > > > +/* The protocol operation code MC_CMD_TSA_BIND_OP_TEST_MCDI that is sent back
> > > > + * to the caller.
> > > > + */
> > > > +#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_OP_OFST 0
> > > > +#define MC_CMD_TSA_BIND_OUT_TEST_MCDI_OP_LEN 4
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE
> > > > + * Manage the persistent NVRAM cache of security rules created with
> > > > + * MC_CMD_SET_SECURITY_RULE. Note that the cache is not automatically updated
> > > > + * as rules are added or removed; the active ruleset must be explicitly
> > > > + * committed to the cache. The cache may also be explicitly invalidated,
> > > > + * without affecting the currently active ruleset. When the cache is valid, it
> > > > + * will be loaded at power on or MC reboot, instead of the default ruleset.
> > > > + * Rollback of the currently active ruleset to the cached version (when it is
> > > > + * valid) is also supported. (Medford-only; for use by SolarSecure apps, not
> > > > + * directly by drivers. See SF-114946-SW.) NOTE - The only sub-operation
> > > > + * allowed in an adapter bound to a TSA controller from the local host is
> > > > + * OP_GET_CACHED_VERSION. All other sub-operations are prohibited.
> > > > + */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE 0x11a
> > > > +#undef MC_CMD_0x11a_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x11a_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN msgrequest */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_LEN 4
> > > > +/* the operation to perform */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_OFST 0
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_LEN 4
> > > > +/* enum: reports the ruleset version that is cached in persistent storage but
> > > > + * performs no other action
> > > > + */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_GET_CACHED_VERSION 0x0
> > > > +/* enum: rolls back the active state to the cached version. (May fail with
> > > > + * ENOENT if there is no valid cached version.)
> > > > + */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_ROLLBACK 0x1
> > > > +/* enum: commits the active state to the persistent cache */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_COMMIT 0x2
> > > > +/* enum: invalidates the persistent cache without affecting the active state */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_IN_OP_INVALIDATE 0x3
> > > > +
> > > > +/* MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT msgresponse */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMIN 5
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMAX 252
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_LEN(num) (4+1*(num))
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_NUM(len) (((len)-4)/1)
> > > > +/* indicates whether the persistent cache is valid (after completion of the
> > > > + * requested operation in the case of rollback, commit, or invalidate)
> > > > + */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_OFST 0
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_LEN 4
> > > > +/* enum: persistent cache is invalid (the VERSION field will be empty in this
> > > > + * case)
> > > > + */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_INVALID 0x0
> > > > +/* enum: persistent cache is valid */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_STATE_VALID 0x1
> > > > +/* cached ruleset version (after completion of the requested operation, in the
> > > > + * case of rollback, commit, or invalidate) as an opaque hash value in the same
> > > > + * form as MC_CMD_GET_SECURITY_RULESET_VERSION_OUT_VERSION
> > > > + */
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_OFST 4
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_LEN 1
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MINNUM 1
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MAXNUM 248
> > > > +#define MC_CMD_MANAGE_SECURITY_RULESET_CACHE_OUT_VERSION_MAXNUM_MCDI2 1016
> > > > +
> > > > +
> > > > /***********************************/
> > > > /* MC_CMD_NVRAM_PRIVATE_APPEND
> > > > * Append a single TLV to the MC_USAGE_TLV partition. Returns MC_CMD_ERR_EEXIST
> > > > @@ -23087,7 +25047,7 @@
> > > > #define MC_CMD_NVRAM_PRIVATE_APPEND 0x11c
> > > > #undef MC_CMD_0x11c_PRIVILEGE_CTG
> > > >
> > > > -#define MC_CMD_0x11c_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +#define MC_CMD_0x11c_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > >
> > > > /* MC_CMD_NVRAM_PRIVATE_APPEND_IN msgrequest */
> > > > #define MC_CMD_NVRAM_PRIVATE_APPEND_IN_LENMIN 9
> > > > @@ -23409,6 +25369,38 @@
> > > > #define MC_CMD_DEALLOCATE_TX_VFIFO_CP_OUT_LEN 0
> > > >
> > > >
> > > > +/***********************************/
> > > > +/* MC_CMD_REKEY
> > > > + * This request causes the NIC to generate a new per-NIC key and program it
> > > > + * into the write-once memory. During the process all flash partitions that are
> > > > + * protected with a CMAC are verified with the old per-NIC key and then signed
> > > > + * with the new per-NIC key. If the NIC has already reached its rekey limit the
> > > > + * REKEY op will return MC_CMD_ERR_ERANGE. The REKEY op may block until
> > > > + * completion or it may return 0 and continue processing, therefore the caller
> > > > + * must poll at least once to confirm that the rekeying has completed. The POLL
> > > > + * operation returns MC_CMD_ERR_EBUSY if the rekey process is still running
> > > > + * otherwise it will return the result of the last completed rekey operation,
> > > > + * or 0 if there has not been a previous rekey.
> > > > + */
> > > > +#define MC_CMD_REKEY 0x123
> > > > +#undef MC_CMD_0x123_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x123_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_REKEY_IN msgrequest */
> > > > +#define MC_CMD_REKEY_IN_LEN 4
> > > > +/* the type of operation requested */
> > > > +#define MC_CMD_REKEY_IN_OP_OFST 0
> > > > +#define MC_CMD_REKEY_IN_OP_LEN 4
> > > > +/* enum: Start the rekeying operation */
> > > > +#define MC_CMD_REKEY_IN_OP_REKEY 0x0
> > > > +/* enum: Poll for completion of the rekeying operation */
> > > > +#define MC_CMD_REKEY_IN_OP_POLL 0x1
> > > > +
> > > > +/* MC_CMD_REKEY_OUT msgresponse */
> > > > +#define MC_CMD_REKEY_OUT_LEN 0
> > > > +
> > > > +
> > > > /***********************************/
> > > > /* MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS
> > > > * This interface allows the host to find out how many common pool buffers are
> > > > @@ -23432,6 +25424,945 @@
> > > > #define MC_CMD_SWITCH_GET_UNASSIGNED_BUFFERS_OUT_ENG_LEN 4
> > > >
> > > >
> > > > +/***********************************/
> > > > +/* MC_CMD_SET_SECURITY_FUSES
> > > > + * Change the security level of the adapter by setting bits in the write-once
> > > > + * memory. The firmware maps each flag in the message to a set of one or more
> > > > + * hardware-defined or software-defined bits and sets these bits in the write-
> > > > + * once memory. For Medford the hardware-defined bits are defined in
> > > > + * SF-112079-PS 5.3, the software-defined bits are defined in xpm.h. Returns 0
> > > > + * if all of the required bits were set and returns MC_CMD_ERR_EIO if any of
> > > > + * the required bits were not set.
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_FUSES 0x126
> > > > +#undef MC_CMD_0x126_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x126_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_SET_SECURITY_FUSES_IN msgrequest */
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_LEN 4
> > > > +/* Flags specifying what type of security features are being set */
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_FLAGS_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_FLAGS_LEN 4
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_LBN 0
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_SECURE_BOOT_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_LBN 1
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_REJECT_TEST_SIGNED_WIDTH 1
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_LBN 31
> > > > +#define MC_CMD_SET_SECURITY_FUSES_IN_SOFT_CONFIG_WIDTH 1
> > > > +
> > > > +/* MC_CMD_SET_SECURITY_FUSES_OUT msgresponse */
> > > > +#define MC_CMD_SET_SECURITY_FUSES_OUT_LEN 0
> > > > +
> > > > +/* MC_CMD_SET_SECURITY_FUSES_V2_OUT msgresponse */
> > > > +#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_LEN 4
> > > > +/* Flags specifying which security features are enforced on the NIC after the
> > > > + * flags in the request have been applied. See
> > > > + * MC_CMD_SET_SECURITY_FUSES_IN/FLAGS for flag definitions.
> > > > + */
> > > > +#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_FLAGS_OFST 0
> > > > +#define MC_CMD_SET_SECURITY_FUSES_V2_OUT_FLAGS_LEN 4
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_TSA_INFO
> > > > + * Messages sent from TSA adapter to TSA controller. This command is only valid
> > > > + * when the MCDI header has MESSAGE_TYPE set to MCDI_MESSAGE_TYPE_TSA. This
> > > > + * command is not sent by the driver to the MC; it is sent from the MC to a TSA
> > > > + * controller, being treated more like an alert message rather than a command;
> > > > + * hence the MC does not expect a response in return. Doxbox reference
> > > > + * SF-117371-SW
> > > > + */
> > > > +#define MC_CMD_TSA_INFO 0x127
> > > > +#undef MC_CMD_0x127_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x127_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_TSA_INFO_IN msgrequest */
> > > > +#define MC_CMD_TSA_INFO_IN_LEN 4
> > > > +#define MC_CMD_TSA_INFO_IN_OP_HDR_OFST 0
> > > > +#define MC_CMD_TSA_INFO_IN_OP_HDR_LEN 4
> > > > +#define MC_CMD_TSA_INFO_IN_OP_OFST 0
> > > > +#define MC_CMD_TSA_INFO_IN_OP_LBN 0
> > > > +#define MC_CMD_TSA_INFO_IN_OP_WIDTH 16
> > > > +/* enum: Information about recently discovered local IP address of the adapter
> > > > + */
> > > > +#define MC_CMD_TSA_INFO_OP_LOCAL_IP 0x1
> > > > +/* enum: Information about a sampled packet that either - did not match any
> > > > + * black/white-list filters and was allowed by the default filter or - did not
> > > > + * match any black/white-list filters and was denied by the default filter
> > > > + */
> > > > +#define MC_CMD_TSA_INFO_OP_PKT_SAMPLE 0x2
> > > > +/* enum: Information about an unbind or decommission attempt. */
> > > > +#define MC_CMD_TSA_INFO_OP_UNBIND 0x3
> > > > +
> > > > +/* MC_CMD_TSA_INFO_IN_LOCAL_IP msgrequest:
> > > > + *
> > > > + * The TSA controller maintains a list of IP addresses valid for each port of a
> > > > + * TSA adapter. The TSA controller requires information from the adapter
> > > > + * inorder to learn new IP addresses assigned to a physical port and to
> > > > + * identify those that are no longer assigned to the physical port. For this
> > > > + * purpose, the TSA adapter snoops ARP replys, gratuitous ARP requests and ARP
> > > > + * probe packets seen on each physical port. This definition describes the
> > > > + * format of the notification message sent from a TSA adapter to a TSA
> > > > + * controller related to any information related to a change in IP address
> > > > + * assignment for a port. Doxbox reference SF-117371.
> > > > + *
> > > > + * There may be a possibility of combining multiple notifications in a single
> > > > + * message in future. When that happens, a new flag can be defined using the
> > > > + * reserved bits to describe the extended format of this notification.
> > > > + */
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_LEN 18
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_OP_HDR_OFST 0
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_OP_HDR_LEN 4
> > > > +/* Additional metadata describing the IP address information such as source of
> > > > + * information retrieval, type of IP address, physical port number.
> > > > + */
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_LEN 4
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_LBN 0
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_PORT_INDEX_WIDTH 8
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_LBN 8
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED_WIDTH 8
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_LBN 16
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_REASON_WIDTH 8
> > > > +/* enum: ARP reply sent out of the physical port */
> > > > +#define MC_CMD_TSA_INFO_IP_REASON_TX_ARP 0x0
> > > > +/* enum: ARP probe packet received on the physical port */
> > > > +#define MC_CMD_TSA_INFO_IP_REASON_RX_ARP_PROBE 0x1
> > > > +/* enum: Gratuitous ARP packet received on the physical port */
> > > > +#define MC_CMD_TSA_INFO_IP_REASON_RX_GRATUITOUS_ARP 0x2
> > > > +/* enum: DHCP ACK packet received on the physical port */
> > > > +#define MC_CMD_TSA_INFO_IP_REASON_RX_DHCP_ACK 0x3
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_LBN 24
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_META_IPV4_WIDTH 1
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_LBN 25
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_RESERVED1_WIDTH 7
> > > > +/* IPV4 address retrieved from the sampled packets. This field is relevant only
> > > > + * when META_IPV4 is set to 1.
> > > > + */
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_IPV4_ADDR_OFST 8
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_IPV4_ADDR_LEN 4
> > > > +/* Target MAC address retrieved from the sampled packet. */
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_OFST 12
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_LEN 1
> > > > +#define MC_CMD_TSA_INFO_IN_LOCAL_IP_MAC_ADDR_NUM 6
> > > > +
> > > > +/* MC_CMD_TSA_INFO_IN_PKT_SAMPLE msgrequest:
> > > > + *
> > > > + * It is desireable for the TSA controller to learn the traffic pattern of
> > > > + * packets seen at the network port being monitored. In order to learn about
> > > > + * the traffic pattern, the TSA controller may want to sample packets seen at
> > > > + * the network port. Based on the packet samples that the TSA controller
> > > > + * receives from the adapter, the controller may choose to configure additional
> > > > + * black-list or white-list rules to allow or block packets as required.
> > > > + *
> > > > + * Although the entire sampled packet as seen on the network port is available
> > > > + * to the MC the length of sampled packet sent to controller is restricted by
> > > > + * MCDI payload size. Besides, the TSA controller does not require the entire
> > > > + * packet to make decisions about filter updates. Hence the packet sample being
> > > > + * passed to the controller is truncated to 128 bytes. This length is large
> > > > + * enough to hold the ethernet header, IP header and maximum length of
> > > > + * supported L4 protocol headers (IPv4 only, but can hold IPv6 header too, if
> > > > + * required in future).
> > > > + *
> > > > + * The intention is that any future changes to this message format that are not
> > > > + * backwards compatible will be defined with a new operation code.
> > > > + */
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_LEN 136
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_OP_HDR_OFST 0
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_OP_HDR_LEN 4
> > > > +/* Additional metadata describing the sampled packet */
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_LEN 4
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_LBN 0
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_PORT_INDEX_WIDTH 8
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_LBN 8
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_DIRECTION_WIDTH 1
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_LBN 9
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_RESERVED_WIDTH 7
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_LBN 16
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_MASK_WIDTH 4
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_LBN 16
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_ALLOW_WIDTH 1
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_LBN 17
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_DENY_WIDTH 1
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_LBN 18
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_META_ACTION_COUNT_WIDTH 1
> > > > +/* 128-byte raw prefix of the sampled packet which includes the ethernet
> > > > + * header, IP header and L4 protocol header (only IPv4 supported initially).
> > > > + * This provides the controller enough information about the packet sample to
> > > > + * report traffic patterns seen on a network port and to make decisions
> > > > + * concerning rule-set updates.
> > > > + */
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_OFST 8
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_LEN 1
> > > > +#define MC_CMD_TSA_INFO_IN_PKT_SAMPLE_PACKET_DATA_NUM 128
> > > > +
> > > > +/* MC_CMD_TSA_INFO_IN_UNBIND msgrequest: Information about an unbind or
> > > > + * decommission attempt. The purpose of this event is to let the controller
> > > > + * know about unbind and decommission attempts (both successful and failed)
> > > > + * received from the adapter host. The event is not sent if the unbind or
> > > > + * decommission request was received from the controller.
> > > > + */
> > > > +#define MC_CMD_TSA_INFO_IN_UNBIND_LEN 12
> > > > +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_HDR_OFST 0
> > > > +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_HDR_LEN 4
> > > > +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_OFST 0
> > > > +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_LBN 0
> > > > +#define MC_CMD_TSA_INFO_IN_UNBIND_OP_WIDTH 16
> > > > +/* Type of the unbind attempt. */
> > > > +#define MC_CMD_TSA_INFO_IN_UNBIND_TYPE_OFST 4
> > > > +#define MC_CMD_TSA_INFO_IN_UNBIND_TYPE_LEN 4
> > > > +/* enum: This event is sent because MC_CMD_TSA_BIND_OP_SECURE_UNBIND was
> > > > + * received from the adapter local host.
> > > > + */
> > > > +#define MC_CMD_TSA_INFO_UNBIND_TYPE_SECURE_UNBIND 0x1
> > > > +/* enum: This event is sent because MC_CMD_TSA_BIND_OP_SECURE_DECOMMISSION was
> > > > + * received from the adapter local host.
> > > > + */
> > > > +#define MC_CMD_TSA_INFO_UNBIND_TYPE_SECURE_DECOMMISSION 0x2
> > > > +/* Result of the attempt. */
> > > > +#define MC_CMD_TSA_INFO_IN_UNBIND_RESULT_OFST 8
> > > > +#define MC_CMD_TSA_INFO_IN_UNBIND_RESULT_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MC_CMD_TSA_BIND/MC_CMD_TSA_BIND_OUT_SECURE_UNBIND/RESULT */
> > > > +
> > > > +/* MC_CMD_TSA_INFO_OUT msgresponse */
> > > > +#define MC_CMD_TSA_INFO_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_HOST_INFO
> > > > + * Commands to appply or retrieve host-related information from an adapter.
> > > > + * Doxbox reference SF-117371-SW
> > > > + */
> > > > +#define MC_CMD_HOST_INFO 0x128
> > > > +#undef MC_CMD_0x128_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x128_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_HOST_INFO_IN msgrequest */
> > > > +#define MC_CMD_HOST_INFO_IN_LEN 4
> > > > +/* sub-operation code info */
> > > > +#define MC_CMD_HOST_INFO_IN_OP_HDR_OFST 0
> > > > +#define MC_CMD_HOST_INFO_IN_OP_HDR_LEN 4
> > > > +#define MC_CMD_HOST_INFO_IN_OP_OFST 0
> > > > +#define MC_CMD_HOST_INFO_IN_OP_LBN 0
> > > > +#define MC_CMD_HOST_INFO_IN_OP_WIDTH 16
> > > > +/* enum: Read a 16-byte unique host identifier from the adapter. This UUID
> > > > + * helps to identify the host that an adapter is plugged into. This identifier
> > > > + * is ideally the system UUID retrieved and set by the UEFI driver. If the UEFI
> > > > + * driver is unable to extract the system UUID, it would still set a random
> > > > + * 16-byte value into each supported SF adapter plugged into it. Host UUIDs may
> > > > + * change if the system is power-cycled, however, they persist across adapter
> > > > + * resets. If the host UUID was not set on an adapter, due to an unsupported
> > > > + * version of UEFI driver, then this command returns an error. Doxbox reference
> > > > + * - SF-117371-SW section 'Host UUID'.
> > > > + */
> > > > +#define MC_CMD_HOST_INFO_OP_GET_UUID 0x0
> > > > +/* enum: Set a 16-byte unique host identifier on the adapter to identify the
> > > > + * host that the adapter is plugged into. See MC_CMD_HOST_INFO_OP_GET_UUID for
> > > > + * further details.
> > > > + */
> > > > +#define MC_CMD_HOST_INFO_OP_SET_UUID 0x1
> > > > +
> > > > +/* MC_CMD_HOST_INFO_IN_GET_UUID msgrequest */
> > > > +#define MC_CMD_HOST_INFO_IN_GET_UUID_LEN 4
> > > > +/* sub-operation code info */
> > > > +#define MC_CMD_HOST_INFO_IN_GET_UUID_OP_HDR_OFST 0
> > > > +#define MC_CMD_HOST_INFO_IN_GET_UUID_OP_HDR_LEN 4
> > > > +
> > > > +/* MC_CMD_HOST_INFO_OUT_GET_UUID msgresponse */
> > > > +#define MC_CMD_HOST_INFO_OUT_GET_UUID_LEN 16
> > > > +/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
> > > > + * for further details.
> > > > + */
> > > > +#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_OFST 0
> > > > +#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_LEN 1
> > > > +#define MC_CMD_HOST_INFO_OUT_GET_UUID_HOST_UUID_NUM 16
> > > > +
> > > > +/* MC_CMD_HOST_INFO_IN_SET_UUID msgrequest */
> > > > +#define MC_CMD_HOST_INFO_IN_SET_UUID_LEN 20
> > > > +/* sub-operation code info */
> > > > +#define MC_CMD_HOST_INFO_IN_SET_UUID_OP_HDR_OFST 0
> > > > +#define MC_CMD_HOST_INFO_IN_SET_UUID_OP_HDR_LEN 4
> > > > +/* 16-byte host UUID set on the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID for
> > > > + * further details.
> > > > + */
> > > > +#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_OFST 4
> > > > +#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_LEN 1
> > > > +#define MC_CMD_HOST_INFO_IN_SET_UUID_HOST_UUID_NUM 16
> > > > +
> > > > +/* MC_CMD_HOST_INFO_OUT_SET_UUID msgresponse */
> > > > +#define MC_CMD_HOST_INFO_OUT_SET_UUID_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_TSAN_INFO
> > > > + * Get TSA adapter information. TSA controllers query each TSA adapter to learn
> > > > + * some configuration parameters of each adapter. Doxbox reference SF-117371-SW
> > > > + * section 'Adapter Information'
> > > > + */
> > > > +#define MC_CMD_TSAN_INFO 0x129
> > > > +#undef MC_CMD_0x129_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x129_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_TSAN_INFO_IN msgrequest */
> > > > +#define MC_CMD_TSAN_INFO_IN_LEN 4
> > > > +/* sub-operation code info */
> > > > +#define MC_CMD_TSAN_INFO_IN_OP_HDR_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_IN_OP_HDR_LEN 4
> > > > +#define MC_CMD_TSAN_INFO_IN_OP_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_IN_OP_LBN 0
> > > > +#define MC_CMD_TSAN_INFO_IN_OP_WIDTH 16
> > > > +/* enum: Read configuration parameters and IDs that uniquely identify an
> > > > + * adapter. The parameters include - host identification, adapter
> > > > + * identification string and number of physical ports on the adapter.
> > > > + */
> > > > +#define MC_CMD_TSAN_INFO_OP_GET_CFG 0x0
> > > > +
> > > > +/* MC_CMD_TSAN_INFO_IN_GET_CFG msgrequest */
> > > > +#define MC_CMD_TSAN_INFO_IN_GET_CFG_LEN 4
> > > > +/* sub-operation code info */
> > > > +#define MC_CMD_TSAN_INFO_IN_GET_CFG_OP_HDR_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_IN_GET_CFG_OP_HDR_LEN 4
> > > > +
> > > > +/* MC_CMD_TSAN_INFO_OUT_GET_CFG msgresponse */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_LEN 26
> > > > +/* Information about the configuration parameters returned in this response. */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CONFIG_WORD_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CONFIG_WORD_LEN 4
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_LBN 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_CAP_FLAGS_WIDTH 16
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_LBN 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_FLAG_HOST_UUID_VALID_WIDTH 1
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_LBN 16
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_NUM_PORTS_WIDTH 8
> > > > +/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
> > > > + * for further details.
> > > > + */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_OFST 4
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_LEN 1
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_HOST_UUID_NUM 16
> > > > +/* A unique identifier per adapter. The base MAC address of the card is used
> > > > + * for this purpose.
> > > > + */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_OFST 20
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_LEN 1
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_GUID_NUM 6
> > > > +
> > > > +/* MC_CMD_TSAN_INFO_OUT_GET_CFG_V2 msgresponse */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_LEN 36
> > > > +/* Information about the configuration parameters returned in this response. */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CONFIG_WORD_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CONFIG_WORD_LEN 4
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_LBN 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_CAP_FLAGS_WIDTH 16
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_LBN 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_FLAG_HOST_UUID_VALID_WIDTH 1
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_OFST 0
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_LBN 16
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_NUM_PORTS_WIDTH 8
> > > > +/* 16-byte host UUID read out of the adapter. See MC_CMD_HOST_INFO_OP_GET_UUID
> > > > + * for further details.
> > > > + */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_OFST 4
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_LEN 1
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_HOST_UUID_NUM 16
> > > > +/* A unique identifier per adapter. The base MAC address of the card is used
> > > > + * for this purpose.
> > > > + */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_OFST 20
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_LEN 1
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_GUID_NUM 6
> > > > +/* Unused bytes, defined for 32-bit alignment of new fields. */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_UNUSED_OFST 26
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_UNUSED_LEN 2
> > > > +/* Maximum number of TSA statistics counters in each direction of dataflow
> > > > + * supported on the card. Note that the statistics counters are always
> > > > + * allocated in pairs, i.e. a counter ID is associated with one Tx and one Rx
> > > > + * counter.
> > > > + */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_MAX_STATS_OFST 28
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_MAX_STATS_LEN 4
> > > > +/* Width of each statistics counter (represented in bits). This gives an
> > > > + * indication of wrap point to the user.
> > > > + */
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_STATS_WIDTH_OFST 32
> > > > +#define MC_CMD_TSAN_INFO_OUT_GET_CFG_V2_STATS_WIDTH_LEN 4
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_TSA_STATISTICS
> > > > + * TSA adapter statistics operations.
> > > > + */
> > > > +#define MC_CMD_TSA_STATISTICS 0x130
> > > > +#undef MC_CMD_0x130_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x130_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_TSA_STATISTICS_IN msgrequest */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_LEN 4
> > > > +/* TSA statistics sub-operation code */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_OP_CODE_OFST 0
> > > > +#define MC_CMD_TSA_STATISTICS_IN_OP_CODE_LEN 4
> > > > +/* enum: Get the configuration parameters that describe the TSA statistics
> > > > + * layout on the adapter.
> > > > + */
> > > > +#define MC_CMD_TSA_STATISTICS_OP_GET_CONFIG 0x0
> > > > +/* enum: Read and/or clear TSA statistics counters. */
> > > > +#define MC_CMD_TSA_STATISTICS_OP_READ_CLEAR 0x1
> > > > +
> > > > +/* MC_CMD_TSA_STATISTICS_IN_GET_CONFIG msgrequest */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_LEN 4
> > > > +/* TSA statistics sub-operation code */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_OP_CODE_OFST 0
> > > > +#define MC_CMD_TSA_STATISTICS_IN_GET_CONFIG_OP_CODE_LEN 4
> > > > +
> > > > +/* MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG msgresponse */
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_LEN 8
> > > > +/* Maximum number of TSA statistics counters in each direction of dataflow
> > > > + * supported on the card. Note that the statistics counters are always
> > > > + * allocated in pairs, i.e. a counter ID is associated with one Tx and one Rx
> > > > + * counter.
> > > > + */
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_MAX_STATS_OFST 0
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_MAX_STATS_LEN 4
> > > > +/* Width of each statistics counter (represented in bits). This gives an
> > > > + * indication of wrap point to the user.
> > > > + */
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_STATS_WIDTH_OFST 4
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_GET_CONFIG_STATS_WIDTH_LEN 4
> > > > +
> > > > +/* MC_CMD_TSA_STATISTICS_IN_READ_CLEAR msgrequest */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMIN 20
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMAX 252
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LEN(num) (16+4*(num))
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_NUM(len) (((len)-16)/4)
> > > > +/* TSA statistics sub-operation code */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_OP_CODE_OFST 0
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_OP_CODE_LEN 4
> > > > +/* Parameters describing the statistics operation */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_FLAGS_OFST 4
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_FLAGS_LEN 4
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_OFST 4
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_LBN 0
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_READ_WIDTH 1
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_OFST 4
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_LBN 1
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_CLEAR_WIDTH 1
> > > > +/* Counter ID list specification type */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_MODE_OFST 8
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_MODE_LEN 4
> > > > +/* enum: The statistics counters are specified as an unordered list of
> > > > + * individual counter ID.
> > > > + */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_LIST 0x0
> > > > +/* enum: The statistics counters are specified as a range of consecutive
> > > > + * counter IDs.
> > > > + */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_RANGE 0x1
> > > > +/* Number of statistics counters */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_NUM_STATS_OFST 12
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_NUM_STATS_LEN 4
> > > > +/* Counter IDs to be read/cleared. When mode is set to LIST, this entry holds a
> > > > + * list of counter IDs to be operated on. When mode is set to RANGE, this entry
> > > > + * holds a single counter ID representing the start of the range of counter IDs
> > > > + * to be operated on.
> > > > + */
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_OFST 16
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_LEN 4
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MINNUM 1
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MAXNUM 59
> > > > +#define MC_CMD_TSA_STATISTICS_IN_READ_CLEAR_COUNTER_ID_MAXNUM_MCDI2 251
> > > > +
> > > > +/* MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR msgresponse */
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMIN 24
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMAX 248
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LENMAX_MCDI2 1016
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_LEN(num) (8+16*(num))
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_NUM(len) (((len)-8)/16)
> > > > +/* Number of statistics counters returned in this response */
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_NUM_STATS_OFST 0
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_NUM_STATS_LEN 4
> > > > +/* MC_TSA_STATISTICS_ENTRY Note that this field is expected to start at a
> > > > + * 64-bit aligned offset
> > > > + */
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_OFST 8
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_LEN 16
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MINNUM 1
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MAXNUM 15
> > > > +#define MC_CMD_TSA_STATISTICS_OUT_READ_CLEAR_STATS_COUNTERS_MAXNUM_MCDI2 63
> > > > +
> > > > +/* MC_TSA_STATISTICS_ENTRY structuredef */
> > > > +#define MC_TSA_STATISTICS_ENTRY_LEN 16
> > > > +/* Tx statistics counter */
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_OFST 0
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LEN 8
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_OFST 0
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_LEN 4
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_LBN 0
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LO_WIDTH 32
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_OFST 4
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_LEN 4
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_LBN 32
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_HI_WIDTH 32
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_LBN 0
> > > > +#define MC_TSA_STATISTICS_ENTRY_TX_STAT_WIDTH 64
> > > > +/* Rx statistics counter */
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_OFST 8
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LEN 8
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_OFST 8
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_LEN 4
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_LBN 64
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LO_WIDTH 32
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_OFST 12
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_LEN 4
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_LBN 96
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_HI_WIDTH 32
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_LBN 64
> > > > +#define MC_TSA_STATISTICS_ENTRY_RX_STAT_WIDTH 64
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_ERASE_INITIAL_NIC_SECRET
> > > > + * This request causes the NIC to find the initial NIC secret (programmed
> > > > + * during ATE) in XPM memory and if and only if the NIC has already been
> > > > + * rekeyed with MC_CMD_REKEY, erase it. This is used by manftest after
> > > > + * installing TSA binding certificates. See SF-117631-TC.
> > > > + */
> > > > +#define MC_CMD_ERASE_INITIAL_NIC_SECRET 0x131
> > > > +#undef MC_CMD_0x131_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x131_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_ERASE_INITIAL_NIC_SECRET_IN msgrequest */
> > > > +#define MC_CMD_ERASE_INITIAL_NIC_SECRET_IN_LEN 0
> > > > +
> > > > +/* MC_CMD_ERASE_INITIAL_NIC_SECRET_OUT msgresponse */
> > > > +#define MC_CMD_ERASE_INITIAL_NIC_SECRET_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_TSA_CONFIG
> > > > + * TSA adapter configuration operations. This command is used to prepare the
> > > > + * NIC for TSA binding.
> > > > + */
> > > > +#define MC_CMD_TSA_CONFIG 0x64
> > > > +#undef MC_CMD_0x64_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x64_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_TSA_CONFIG_IN msgrequest */
> > > > +#define MC_CMD_TSA_CONFIG_IN_LEN 4
> > > > +/* TSA configuration sub-operation code */
> > > > +#define MC_CMD_TSA_CONFIG_IN_OP_OFST 0
> > > > +#define MC_CMD_TSA_CONFIG_IN_OP_LEN 4
> > > > +/* enum: Append a single item to the tsa_config partition. Items will be
> > > > + * encrypted unless they are declared as non-sensitive. Returns
> > > > + * MC_CMD_ERR_EEXIST if the tag is already present.
> > > > + */
> > > > +#define MC_CMD_TSA_CONFIG_OP_APPEND 0x1
> > > > +/* enum: Reset the tsa_config partition to a clean state. */
> > > > +#define MC_CMD_TSA_CONFIG_OP_RESET 0x2
> > > > +/* enum: Read back a configured item from tsa_config partition. Returns
> > > > + * MC_CMD_ERR_ENOENT if the item doesn't exist, or MC_CMD_ERR_EPERM if the item
> > > > + * is declared as sensitive (i.e. is encrypted).
> > > > + */
> > > > +#define MC_CMD_TSA_CONFIG_OP_READ 0x3
> > > > +
> > > > +/* MC_CMD_TSA_CONFIG_IN_APPEND msgrequest */
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMIN 12
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMAX 252
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LEN(num) (12+1*(num))
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_NUM(len) (((len)-12)/1)
> > > > +/* TSA configuration sub-operation code. The value shall be
> > > > + * MC_CMD_TSA_CONFIG_OP_APPEND.
> > > > + */
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_OP_OFST 0
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_OP_LEN 4
> > > > +/* The tag to be appended */
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_TAG_OFST 4
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_TAG_LEN 4
> > > > +/* The length of the data in bytes */
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENGTH_OFST 8
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_LENGTH_LEN 4
> > > > +/* The item data */
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_OFST 12
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_LEN 1
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MINNUM 0
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MAXNUM 240
> > > > +#define MC_CMD_TSA_CONFIG_IN_APPEND_DATA_MAXNUM_MCDI2 1008
> > > > +
> > > > +/* MC_CMD_TSA_CONFIG_OUT_APPEND msgresponse */
> > > > +#define MC_CMD_TSA_CONFIG_OUT_APPEND_LEN 0
> > > > +
> > > > +/* MC_CMD_TSA_CONFIG_IN_RESET msgrequest */
> > > > +#define MC_CMD_TSA_CONFIG_IN_RESET_LEN 4
> > > > +/* TSA configuration sub-operation code. The value shall be
> > > > + * MC_CMD_TSA_CONFIG_OP_RESET.
> > > > + */
> > > > +#define MC_CMD_TSA_CONFIG_IN_RESET_OP_OFST 0
> > > > +#define MC_CMD_TSA_CONFIG_IN_RESET_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_TSA_CONFIG_OUT_RESET msgresponse */
> > > > +#define MC_CMD_TSA_CONFIG_OUT_RESET_LEN 0
> > > > +
> > > > +/* MC_CMD_TSA_CONFIG_IN_READ msgrequest */
> > > > +#define MC_CMD_TSA_CONFIG_IN_READ_LEN 8
> > > > +/* TSA configuration sub-operation code. The value shall be
> > > > + * MC_CMD_TSA_CONFIG_OP_READ.
> > > > + */
> > > > +#define MC_CMD_TSA_CONFIG_IN_READ_OP_OFST 0
> > > > +#define MC_CMD_TSA_CONFIG_IN_READ_OP_LEN 4
> > > > +/* The tag to be read */
> > > > +#define MC_CMD_TSA_CONFIG_IN_READ_TAG_OFST 4
> > > > +#define MC_CMD_TSA_CONFIG_IN_READ_TAG_LEN 4
> > > > +
> > > > +/* MC_CMD_TSA_CONFIG_OUT_READ msgresponse */
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_LENMIN 8
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_LENMAX 252
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_LEN(num) (8+1*(num))
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_NUM(len) (((len)-8)/1)
> > > > +/* The tag that was read */
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_TAG_OFST 0
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_TAG_LEN 4
> > > > +/* The length of the data in bytes */
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_LENGTH_OFST 4
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_LENGTH_LEN 4
> > > > +/* The data of the item. */
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_OFST 8
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_LEN 1
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MINNUM 0
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MAXNUM 244
> > > > +#define MC_CMD_TSA_CONFIG_OUT_READ_DATA_MAXNUM_MCDI2 1012
> > > > +
> > > > +/* MC_TSA_IPV4_ITEM structuredef */
> > > > +#define MC_TSA_IPV4_ITEM_LEN 8
> > > > +/* Additional metadata describing the IP address information such as the
> > > > + * physical port number the address is being used on. Unused space in this
> > > > + * field is reserved for future expansion.
> > > > + */
> > > > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_OFST 0
> > > > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_LEN 4
> > > > +#define MC_TSA_IPV4_ITEM_PORT_IDX_OFST 0
> > > > +#define MC_TSA_IPV4_ITEM_PORT_IDX_LBN 0
> > > > +#define MC_TSA_IPV4_ITEM_PORT_IDX_WIDTH 8
> > > > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_LBN 0
> > > > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_META_WIDTH 32
> > > > +/* The IPv4 address in little endian byte order. */
> > > > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_OFST 4
> > > > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_LEN 4
> > > > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_LBN 32
> > > > +#define MC_TSA_IPV4_ITEM_IPV4_ADDR_WIDTH 32
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_TSA_IPADDR
> > > > + * TSA operations relating to the monitoring and expiry of local IP addresses
> > > > + * discovered by the controller. These commands are sent from a TSA controller
> > > > + * to a TSA adapter.
> > > > + */
> > > > +#define MC_CMD_TSA_IPADDR 0x65
> > > > +#undef MC_CMD_0x65_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x65_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_TSA_IPADDR_IN msgrequest */
> > > > +#define MC_CMD_TSA_IPADDR_IN_LEN 4
> > > > +/* Header containing information to identify which sub-operation of this
> > > > + * command to perform. The header contains a 16-bit op-code. Unused space in
> > > > + * this field is reserved for future expansion.
> > > > + */
> > > > +#define MC_CMD_TSA_IPADDR_IN_OP_HDR_OFST 0
> > > > +#define MC_CMD_TSA_IPADDR_IN_OP_HDR_LEN 4
> > > > +#define MC_CMD_TSA_IPADDR_IN_OP_OFST 0
> > > > +#define MC_CMD_TSA_IPADDR_IN_OP_LBN 0
> > > > +#define MC_CMD_TSA_IPADDR_IN_OP_WIDTH 16
> > > > +/* enum: Request that the adapter verifies that the IPv4 addresses supplied are
> > > > + * still in use by the host by sending ARP probes to the host. The MC does not
> > > > + * wait for a response to the probes and sends an MCDI response to the
> > > > + * controller once the probes have been sent to the host. The response to the
> > > > + * probes (if there are any) will be forwarded to the controller using
> > > > + * MC_CMD_TSA_INFO alerts.
> > > > + */
> > > > +#define MC_CMD_TSA_IPADDR_OP_VALIDATE_IPV4 0x1
> > > > +/* enum: Notify the adapter that one or more IPv4 addresses are no longer valid
> > > > + * for the host of the adapter. The adapter should remove the IPv4 addresses
> > > > + * from its local cache.
> > > > + */
> > > > +#define MC_CMD_TSA_IPADDR_OP_REMOVE_IPV4 0x2
> > > > +
> > > > +/* MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4 msgrequest */
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMIN 16
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMAX 248
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LENMAX_MCDI2 1016
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_LEN(num) (8+8*(num))
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_NUM(len) (((len)-8)/8)
> > > > +/* Header containing information to identify which sub-operation of this
> > > > + * command to perform. The header contains a 16-bit op-code. Unused space in
> > > > + * this field is reserved for future expansion.
> > > > + */
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_HDR_OFST 0
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_HDR_LEN 4
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_OFST 0
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_LBN 0
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_OP_WIDTH 16
> > > > +/* Number of IPv4 addresses to validate. */
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_NUM_ITEMS_OFST 4
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_NUM_ITEMS_LEN 4
> > > > +/* The IPv4 addresses to validate, in struct MC_TSA_IPV4_ITEM format. */
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_OFST 8
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LEN 8
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_OFST 8
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_LEN 4
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_LBN 64
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_LO_WIDTH 32
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_OFST 12
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_LEN 4
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_LBN 96
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_HI_WIDTH 32
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MINNUM 1
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MAXNUM 30
> > > > +#define MC_CMD_TSA_IPADDR_IN_VALIDATE_IPV4_IPV4_ITEM_MAXNUM_MCDI2 126
> > > > +
> > > > +/* MC_CMD_TSA_IPADDR_OUT_VALIDATE_IPV4 msgresponse */
> > > > +#define MC_CMD_TSA_IPADDR_OUT_VALIDATE_IPV4_LEN 0
> > > > +
> > > > +/* MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4 msgrequest */
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMIN 16
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMAX 248
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LENMAX_MCDI2 1016
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_LEN(num) (8+8*(num))
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_NUM(len) (((len)-8)/8)
> > > > +/* Header containing information to identify which sub-operation of this
> > > > + * command to perform. The header contains a 16-bit op-code. Unused space in
> > > > + * this field is reserved for future expansion.
> > > > + */
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_HDR_OFST 0
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_HDR_LEN 4
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_OFST 0
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_LBN 0
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_OP_WIDTH 16
> > > > +/* Number of IPv4 addresses to remove. */
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_NUM_ITEMS_OFST 4
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_NUM_ITEMS_LEN 4
> > > > +/* The IPv4 addresses that have expired, in struct MC_TSA_IPV4_ITEM format. */
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_OFST 8
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LEN 8
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_OFST 8
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_LEN 4
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_LBN 64
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_LO_WIDTH 32
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_OFST 12
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_LEN 4
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_LBN 96
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_HI_WIDTH 32
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MINNUM 1
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MAXNUM 30
> > > > +#define MC_CMD_TSA_IPADDR_IN_REMOVE_IPV4_IPV4_ITEM_MAXNUM_MCDI2 126
> > > > +
> > > > +/* MC_CMD_TSA_IPADDR_OUT_REMOVE_IPV4 msgresponse */
> > > > +#define MC_CMD_TSA_IPADDR_OUT_REMOVE_IPV4_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_SECURE_NIC_INFO
> > > > + * Get secure NIC information. While many of the features reported by these
> > > > + * commands are related to TSA, they must be supported in firmware where TSA is
> > > > + * disabled.
> > > > + */
> > > > +#define MC_CMD_SECURE_NIC_INFO 0x132
> > > > +#undef MC_CMD_0x132_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x132_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > > > +
> > > > +/* MC_CMD_SECURE_NIC_INFO_IN msgrequest */
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_LEN 4
> > > > +/* sub-operation code info */
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_OP_HDR_OFST 0
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_OP_HDR_LEN 4
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_OP_OFST 0
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_OP_LBN 0
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_OP_WIDTH 16
> > > > +/* enum: Get the status of various security settings, all signed along with a
> > > > + * challenge chosen by the host.
> > > > + */
> > > > +#define MC_CMD_SECURE_NIC_INFO_OP_STATUS 0x0
> > > > +
> > > > +/* MC_CMD_SECURE_NIC_INFO_IN_STATUS msgrequest */
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_LEN 24
> > > > +/* sub-operation code, must be MC_CMD_SECURE_NIC_INFO_OP_STATUS */
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_OP_HDR_OFST 0
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_OP_HDR_LEN 4
> > > > +/* Type of key to be used to sign response. */
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_KEY_TYPE_OFST 4
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_KEY_TYPE_LEN 4
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_UNUSED 0x0 /* enum */
> > > > +/* enum: Solarflare adapter authentication key, installed by Manftest. */
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_SF_ADAPTER_AUTH 0x1
> > > > +/* enum: TSA binding key, installed after adapter is bound to a TSA controller.
> > > > + * This is not supported in firmware which does not support TSA.
> > > > + */
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_TSA_BINDING 0x2
> > > > +/* enum: Customer adapter authentication key. Installed by the customer in the
> > > > + * field, but otherwise similar to the Solarflare adapter authentication key.
> > > > + */
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CUSTOMER_ADAPTER_AUTH 0x3
> > > > +/* Random challenge generated by the host. */
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CHALLENGE_OFST 8
> > > > +#define MC_CMD_SECURE_NIC_INFO_IN_STATUS_CHALLENGE_LEN 16
> > > > +
> > > > +/* MC_CMD_SECURE_NIC_INFO_OUT_STATUS msgresponse */
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_LEN 420
> > > > +/* Length of the signature in MSG_SIGNATURE. */
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN_OFST 0
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN_LEN 4
> > > > +/* Signature over the message, starting at MESSAGE_TYPE and continuing to the
> > > > + * end of the MCDI response, allowing the message format to be extended. The
> > > > + * signature uses ECDSA 384 encoding in ASN.1 format. It has variable length,
> > > > + * with a maximum of 384 bytes.
> > > > + */
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_OFST 4
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MSG_SIGNATURE_LEN 384
> > > > +/* Enum value indicating the type of response. This protects against chosen
> > > > + * message attacks. The enum values are random rather than sequential to make
> > > > + * it unlikely that values will be reused should other commands in a different
> > > > + * namespace need to create signed messages.
> > > > + */
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MESSAGE_TYPE_OFST 388
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_MESSAGE_TYPE_LEN 4
> > > > +/* enum: Message type value for the response to a
> > > > + * MC_CMD_SECURE_NIC_INFO_IN_STATUS message.
> > > > + */
> > > > +#define MC_CMD_SECURE_NIC_INFO_STATUS 0xdb4
> > > > +/* The challenge provided by the host in the MC_CMD_SECURE_NIC_INFO_IN_STATUS
> > > > + * message
> > > > + */
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_CHALLENGE_OFST 392
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_CHALLENGE_LEN 16
> > > > +/* The first 32 bits of XPM memory, which include security and flag bits, die
> > > > + * ID and chip ID revision. The meaning of these bits is defined in
> > > > + * mc/include/mc/xpm.h in the firmwaresrc repository.
> > > > + */
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_XPM_STATUS_BITS_OFST 408
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_XPM_STATUS_BITS_LEN 4
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_A_OFST 412
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_A_LEN 2
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_B_OFST 414
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_B_LEN 2
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_C_OFST 416
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_C_LEN 2
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_D_OFST 418
> > > > +#define MC_CMD_SECURE_NIC_INFO_OUT_STATUS_FIRMWARE_VERSION_D_LEN 2
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_TSA_TEST
> > > > + * A simple ping-pong command just to test the adapter<>controller MCDI
> > > > + * communication channel. This command makes not changes to the TSA adapter's
> > > > + * internal state. It is used by the controller just to verify that the MCDI
> > > > + * communication channel is working fine. This command takes no additonal
> > > > + * parameters in request or response.
> > > > + */
> > > > +#define MC_CMD_TSA_TEST 0x125
> > > > +#undef MC_CMD_0x125_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x125_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_TSA_TEST_IN msgrequest */
> > > > +#define MC_CMD_TSA_TEST_IN_LEN 0
> > > > +
> > > > +/* MC_CMD_TSA_TEST_OUT msgresponse */
> > > > +#define MC_CMD_TSA_TEST_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_TSA_RULESET_OVERRIDE
> > > > + * Override TSA ruleset that is currently active on the adapter. This operation
> > > > + * does not modify the ruleset itself. This operation provides a mechanism to
> > > > + * apply an allow-all or deny-all operation on all packets, thereby completely
> > > > + * ignoring the rule-set configured on the adapter. The main purpose of this
> > > > + * operation is to provide a deterministic state to the TSA firewall during
> > > > + * rule-set transitions.
> > > > + */
> > > > +#define MC_CMD_TSA_RULESET_OVERRIDE 0x12a
> > > > +#undef MC_CMD_0x12a_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x12a_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_TSA_RULESET_OVERRIDE_IN msgrequest */
> > > > +#define MC_CMD_TSA_RULESET_OVERRIDE_IN_LEN 4
> > > > +/* The override state to apply. */
> > > > +#define MC_CMD_TSA_RULESET_OVERRIDE_IN_STATE_OFST 0
> > > > +#define MC_CMD_TSA_RULESET_OVERRIDE_IN_STATE_LEN 4
> > > > +/* enum: No override in place - the existing ruleset is in operation. */
> > > > +#define MC_CMD_TSA_RULESET_OVERRIDE_NONE 0x0
> > > > +/* enum: Block all packets seen on all datapath channel except those packets
> > > > + * required for basic configuration of the TSA NIC such as ARPs and TSA-
> > > > + * communication traffic. Such exceptional traffic is handled differently
> > > > + * compared to TSA rulesets.
> > > > + */
> > > > +#define MC_CMD_TSA_RULESET_OVERRIDE_BLOCK 0x1
> > > > +/* enum: Allow all packets through all datapath channel. The TSA adapter
> > > > + * behaves like a normal NIC without any firewalls.
> > > > + */
> > > > +#define MC_CMD_TSA_RULESET_OVERRIDE_ALLOW 0x2
> > > > +
> > > > +/* MC_CMD_TSA_RULESET_OVERRIDE_OUT msgresponse */
> > > > +#define MC_CMD_TSA_RULESET_OVERRIDE_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_TSAC_REQUEST
> > > > + * Generic command to send requests from a TSA controller to a TSA adapter.
> > > > + * Specific usage is determined by the TYPE field.
> > > > + */
> > > > +#define MC_CMD_TSAC_REQUEST 0x12b
> > > > +#undef MC_CMD_0x12b_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x12b_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_TSAC_REQUEST_IN msgrequest */
> > > > +#define MC_CMD_TSAC_REQUEST_IN_LEN 4
> > > > +/* The type of request from the controller. */
> > > > +#define MC_CMD_TSAC_REQUEST_IN_TYPE_OFST 0
> > > > +#define MC_CMD_TSAC_REQUEST_IN_TYPE_LEN 4
> > > > +/* enum: Request the adapter to resend localIP information from it's cache. The
> > > > + * command does not return any IP address information; IP addresses are sent as
> > > > + * TSA notifications as descibed in MC_CMD_TSA_INFO_IN_LOCAL_IP.
> > > > + */
> > > > +#define MC_CMD_TSAC_REQUEST_LOCALIP 0x0
> > > > +
> > > > +/* MC_CMD_TSAC_REQUEST_OUT msgresponse */
> > > > +#define MC_CMD_TSAC_REQUEST_OUT_LEN 0
> > > > +
> > > > +
> > > > /***********************************/
> > > > /* MC_CMD_SUC_VERSION
> > > > * Get the version of the SUC
> > > > @@ -23477,6 +26408,580 @@
> > > > #define MC_CMD_SUC_BOOT_VERSION_OUT_VERSION_LEN 4
> > > >
> > > >
> > > > +/***********************************/
> > > > +/* MC_CMD_SUC_MANFTEST
> > > > + * Operations to support manftest on SUC based systems.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST 0x135
> > > > +#undef MC_CMD_0x135_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x135_PRIVILEGE_CTG SRIOV_CTG_ADMIN_TSA_UNBOUND
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_IN_LEN 4
> > > > +/* The manftest operation to be performed. */
> > > > +#define MC_CMD_SUC_MANFTEST_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_IN_OP_LEN 4
> > > > +/* enum: Read serial number and use count. */
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ 0x0
> > > > +/* enum: Update use count on wearout adapter. */
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE 0x1
> > > > +/* enum: Start an ADC calibration. */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START 0x2
> > > > +/* enum: Read the status of an ADC calibration. */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS 0x3
> > > > +/* enum: Read the results of an ADC calibration. */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT 0x4
> > > > +/* enum: Read the PCIe configuration. */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ 0x5
> > > > +/* enum: Write the PCIe configuration. */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE 0x6
> > > > +/* enum: Write FRU information to SUC. The FRU information is taken from the
> > > > + * FRU_INFORMATION partition. Attempts to write to read-only FRUs are rejected.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_FRU_WRITE 0x7
> > > > +/* enum: Read UDID Vendor Specific ID from SUC persistent storage. */
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ 0x8
> > > > +/* enum: Write UDID Vendor Specific ID to SUC persistent storage for use in
> > > > + * SMBus ARP.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE 0x9
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_OUT_LEN 0
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_LEN 4
> > > > +/* The manftest operation to be performed. This must be
> > > > + * MC_CMD_SUC_MANFTEST_WEAROUT_READ.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_LEN 20
> > > > +/* The serial number of the wearout adapter, see SF-112717-PR for format. */
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_SERIAL_NUMBER_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_SERIAL_NUMBER_LEN 16
> > > > +/* The use count of the wearout adapter. */
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_USE_COUNT_OFST 16
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_READ_OUT_USE_COUNT_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_LEN 4
> > > > +/* The manftest operation to be performed. This must be
> > > > + * MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_WEAROUT_UPDATE_OUT_LEN 0
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_LEN 4
> > > > +/* The manftest operation to be performed. This must be
> > > > + * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_START_OUT_LEN 0
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_LEN 4
> > > > +/* The manftest operation to be performed. This must be
> > > > + * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_LEN 4
> > > > +/* The combined status of the calibration operation. */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FLAGS_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FLAGS_LEN 4
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_LBN 0
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_CALIBRATING_WIDTH 1
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_LBN 1
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_FAILED_WIDTH 1
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_LBN 2
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_RESULT_WIDTH 4
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_LBN 6
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_STATUS_OUT_INDEX_WIDTH 2
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_LEN 4
> > > > +/* The manftest operation to be performed. This must be
> > > > + * MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_LEN 12
> > > > +/* The set of calibration results. */
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_LEN 4
> > > > +#define MC_CMD_SUC_MANFTEST_ADC_CALIBRATE_RESULT_OUT_VALUE_NUM 3
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_LEN 4
> > > > +/* The manftest operation to be performed. This must be
> > > > + * MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_LEN 4
> > > > +/* The PCIe vendor ID. */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_VENDOR_ID_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_VENDOR_ID_LEN 2
> > > > +/* The PCIe device ID. */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_DEVICE_ID_OFST 2
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_READ_OUT_DEVICE_ID_LEN 2
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_LEN 8
> > > > +/* The manftest operation to be performed. This must be
> > > > + * MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_OP_LEN 4
> > > > +/* The PCIe vendor ID. */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_VENDOR_ID_OFST 4
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_VENDOR_ID_LEN 2
> > > > +/* The PCIe device ID. */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_DEVICE_ID_OFST 6
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_IN_DEVICE_ID_LEN 2
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_CONFIG_PCIE_WRITE_OUT_LEN 0
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_FRU_WRITE_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_LEN 4
> > > > +/* The manftest operation to be performed. This must be
> > > > + * MC_CMD_SUC_MANFTEST_FRU_WRITE
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_FRU_WRITE_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_FRU_WRITE_OUT_LEN 0
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_LEN 4
> > > > +/* The manftest operation to be performed. This must be
> > > > + * MC_CMD_SUC_MANFTEST_SMBUS_ID_READ.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_LEN 4
> > > > +/* The SMBus ID. */
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_SMBUS_ID_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_READ_OUT_SMBUS_ID_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN msgrequest */
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_LEN 8
> > > > +/* The manftest operation to be performed. This must be
> > > > + * MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE.
> > > > + */
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_OP_OFST 0
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_OP_LEN 4
> > > > +/* The SMBus ID. */
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_SMBUS_ID_OFST 4
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_IN_SMBUS_ID_LEN 4
> > > > +
> > > > +/* MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_OUT msgresponse */
> > > > +#define MC_CMD_SUC_MANFTEST_SMBUS_ID_WRITE_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_GET_CERTIFICATE
> > > > + * Request a certificate.
> > > > + */
> > > > +#define MC_CMD_GET_CERTIFICATE 0x12c
> > > > +#undef MC_CMD_0x12c_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x12c_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > > > +
> > > > +/* MC_CMD_GET_CERTIFICATE_IN msgrequest */
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_LEN 8
> > > > +/* Type of the certificate to be retrieved. */
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_TYPE_OFST 0
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_TYPE_LEN 4
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_UNUSED 0x0 /* enum */
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_AAC 0x1 /* enum */
> > > > +/* enum: Adapter Authentication Certificate (AAC). The AAC is unique to each
> > > > + * adapter and is used to verify its authenticity. It is installed by Manftest.
> > > > + */
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_ADAPTER_AUTH 0x1
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_AASC 0x2 /* enum */
> > > > +/* enum: Adapter Authentication Signing Certificate (AASC). The AASC is shared
> > > > + * by a group of adapters (typically a purchase order) and is used to verify
> > > > + * the validity of AAC along with the SF root certificate. It is installed by
> > > > + * Manftest.
> > > > + */
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_ADAPTER_AUTH_SIGNING 0x2
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_AAC 0x3 /* enum */
> > > > +/* enum: Customer Adapter Authentication Certificate. The Customer AAC is
> > > > + * unique to each adapter and is used to verify its authenticity in cases where
> > > > + * either the AAC is not installed or a customer desires to use their own
> > > > + * certificate chain. It is installed by the customer.
> > > > + */
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_ADAPTER_AUTH 0x3
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_AASC 0x4 /* enum */
> > > > +/* enum: Customer Adapter Authentication Certificate. The Customer AASC is
> > > > + * shared by a group of adapters and is used to verify the validity of the
> > > > + * Customer AAC along with the customers root certificate. It is installed by
> > > > + * the customer.
> > > > + */
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_CUSTOMER_ADAPTER_AUTH_SIGNING 0x4
> > > > +/* Offset, measured in bytes, relative to the start of the certificate data
> > > > + * from which the certificate is to be retrieved.
> > > > + */
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_OFFSET_OFST 4
> > > > +#define MC_CMD_GET_CERTIFICATE_IN_OFFSET_LEN 4
> > > > +
> > > > +/* MC_CMD_GET_CERTIFICATE_OUT msgresponse */
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_LENMIN 13
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_LENMAX 252
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_LEN(num) (12+1*(num))
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_NUM(len) (((len)-12)/1)
> > > > +/* Type of the certificate. */
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_TYPE_OFST 0
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_TYPE_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MC_CMD_GET_CERTIFICATE_IN/TYPE */
> > > > +/* Offset, measured in bytes, relative to the start of the certificate data
> > > > + * from which data in this message starts.
> > > > + */
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_OFFSET_OFST 4
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_OFFSET_LEN 4
> > > > +/* Total length of the certificate data. */
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_TOTAL_LENGTH_OFST 8
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_TOTAL_LENGTH_LEN 4
> > > > +/* The certificate data. */
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_OFST 12
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_LEN 1
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MINNUM 1
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MAXNUM 240
> > > > +#define MC_CMD_GET_CERTIFICATE_OUT_DATA_MAXNUM_MCDI2 1008
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_GET_NIC_GLOBAL
> > > > + * Get a global value which applies to all PCI functions
> > > > + */
> > > > +#define MC_CMD_GET_NIC_GLOBAL 0x12d
> > > > +#undef MC_CMD_0x12d_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x12d_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > > > +
> > > > +/* MC_CMD_GET_NIC_GLOBAL_IN msgrequest */
> > > > +#define MC_CMD_GET_NIC_GLOBAL_IN_LEN 4
> > > > +/* Key to request value for, see enum values in MC_CMD_SET_NIC_GLOBAL. If the
> > > > + * given key is unknown to the current firmware, the call will fail with
> > > > + * ENOENT.
> > > > + */
> > > > +#define MC_CMD_GET_NIC_GLOBAL_IN_KEY_OFST 0
> > > > +#define MC_CMD_GET_NIC_GLOBAL_IN_KEY_LEN 4
> > > > +
> > > > +/* MC_CMD_GET_NIC_GLOBAL_OUT msgresponse */
> > > > +#define MC_CMD_GET_NIC_GLOBAL_OUT_LEN 4
> > > > +/* Value of requested key, see key descriptions below. */
> > > > +#define MC_CMD_GET_NIC_GLOBAL_OUT_VALUE_OFST 0
> > > > +#define MC_CMD_GET_NIC_GLOBAL_OUT_VALUE_LEN 4
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_SET_NIC_GLOBAL
> > > > + * Set a global value which applies to all PCI functions. Most global values
> > > > + * can only be changed under specific conditions, and this call will return an
> > > > + * appropriate error otherwise (see key descriptions).
> > > > + */
> > > > +#define MC_CMD_SET_NIC_GLOBAL 0x12e
> > > > +#undef MC_CMD_0x12e_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x12e_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_SET_NIC_GLOBAL_IN msgrequest */
> > > > +#define MC_CMD_SET_NIC_GLOBAL_IN_LEN 8
> > > > +/* Key to change value of. Firmware will return ENOENT for keys it doesn't know
> > > > + * about.
> > > > + */
> > > > +#define MC_CMD_SET_NIC_GLOBAL_IN_KEY_OFST 0
> > > > +#define MC_CMD_SET_NIC_GLOBAL_IN_KEY_LEN 4
> > > > +/* enum: Request switching the datapath firmware sub-variant. Currently only
> > > > + * useful when running the DPDK f/w variant. See key values below, and the DPDK
> > > > + * section of the EF10 Driver Writers Guide. Note that any driver attaching
> > > > + * with the SUBVARIANT_AWARE flag cleared is implicitly considered as a request
> > > > + * to switch back to the default sub-variant, and will thus reset this value.
> > > > + * If a sub-variant switch happens, all other PCI functions will get their
> > > > + * resources reset (they will see an MC reboot).
> > > > + */
> > > > +#define MC_CMD_SET_NIC_GLOBAL_IN_FIRMWARE_SUBVARIANT 0x1
> > > > +/* New value to set, see key descriptions above. */
> > > > +#define MC_CMD_SET_NIC_GLOBAL_IN_VALUE_OFST 4
> > > > +#define MC_CMD_SET_NIC_GLOBAL_IN_VALUE_LEN 4
> > > > +/* enum: Only if KEY = FIRMWARE_SUBVARIANT. Default sub-variant with support
> > > > + * for maximum features for the current f/w variant. A request from a
> > > > + * privileged function to set this particular value will always succeed.
> > > > + */
> > > > +#define MC_CMD_SET_NIC_GLOBAL_IN_FW_SUBVARIANT_DEFAULT 0x0
> > > > +/* enum: Only if KEY = FIRMWARE_SUBVARIANT. Increases packet rate at the cost
> > > > + * of not supporting any TX checksum offloads. Only supported when running some
> > > > + * f/w variants, others will return ENOTSUP (as reported by the homonymous bit
> > > > + * in MC_CMD_GET_CAPABILITIES_V2). Can only be set when no other drivers are
> > > > + * attached, and the calling driver must have no resources allocated. See the
> > > > + * DPDK section of the EF10 Driver Writers Guide for a more detailed
> > > > + * description with possible error codes.
> > > > + */
> > > > +#define MC_CMD_SET_NIC_GLOBAL_IN_FW_SUBVARIANT_NO_TX_CSUM 0x1
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_LTSSM_TRACE_POLL
> > > > + * Medford2 hardware has support for logging all LTSSM state transitions to a
> > > > + * hardware buffer. When built with WITH_LTSSM_TRACE=1, the firmware will
> > > > + * periodially dump the contents of this hardware buffer to an internal
> > > > + * firmware buffer for later extraction.
> > > > + */
> > > > +#define MC_CMD_LTSSM_TRACE_POLL 0x12f
> > > > +#undef MC_CMD_0x12f_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x12f_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_LTSSM_TRACE_POLL_IN msgrequest: Read transitions from the firmware
> > > > + * internal buffer.
> > > > + */
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_IN_LEN 4
> > > > +/* The maximum number of row that the caller can accept. The format of each row
> > > > + * is defined in MC_CMD_LTSSM_TRACE_POLL_OUT.
> > > > + */
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_IN_MAX_ROW_COUNT_OFST 0
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_IN_MAX_ROW_COUNT_LEN 4
> > > > +
> > > > +/* MC_CMD_LTSSM_TRACE_POLL_OUT msgresponse */
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMIN 16
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMAX 248
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LENMAX_MCDI2 1016
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LEN(num) (8+8*(num))
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_NUM(len) (((len)-8)/8)
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FLAGS_OFST 0
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FLAGS_LEN 4
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_OFST 0
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_LBN 0
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_HW_BUFFER_OVERFLOW_WIDTH 1
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_OFST 0
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_LBN 1
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_FW_BUFFER_OVERFLOW_WIDTH 1
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_OFST 0
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_LBN 31
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_CONTINUES_WIDTH 1
> > > > +/* The number of rows present in this response. */
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROW_COUNT_OFST 4
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROW_COUNT_LEN 4
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_OFST 8
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LEN 8
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_OFST 8
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_LEN 4
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_LBN 64
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_LO_WIDTH 32
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_OFST 12
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_LEN 4
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_LBN 96
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_HI_WIDTH 32
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MINNUM 0
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MAXNUM 30
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_ROWS_MAXNUM_MCDI2 126
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_OFST 8
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_LBN 0
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_LTSSM_STATE_WIDTH 6
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_OFST 8
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_LBN 6
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_RDLH_LINK_UP_WIDTH 1
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_OFST 8
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_LBN 7
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_WAKE_N_WIDTH 1
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_OFST 8
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_LBN 8
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_PS_WIDTH 24
> > > > +/* The time of the LTSSM transition. Times are reported as fractional
> > > > + * microseconds since MC boot (wrapping at 2^32us). The fractional part is
> > > > + * reported in picoseconds. 0 <= TIMESTAMP_PS < 1000000 timestamp in seconds =
> > > > + * ((TIMESTAMP_US + TIMESTAMP_PS / 1000000) / 1000000)
> > > > + */
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_US_OFST 12
> > > > +#define MC_CMD_LTSSM_TRACE_POLL_OUT_TIMESTAMP_US_LEN 4
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_TELEMETRY_ENABLE
> > > > + * This command enables telemetry processing of packets, allowing a remote host
> > > > + * to gather information and analytics passing on the card. Enabling telemetry
> > > > + * will have a performance cost. Not supported on all hardware and datapath
> > > > + * variants. As of writing, only supported on Medford2 running full-featured
> > > > + * firmware variant.
> > > > + */
> > > > +#define MC_CMD_TELEMETRY_ENABLE 0x138
> > > > +#undef MC_CMD_0x138_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x138_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_TELEMETRY_ENABLE_IN msgrequest */
> > > > +#define MC_CMD_TELEMETRY_ENABLE_IN_LEN 4
> > > > +#define MC_CMD_TELEMETRY_ENABLE_IN_STATE_OFST 0
> > > > +#define MC_CMD_TELEMETRY_ENABLE_IN_STATE_LEN 4
> > > > +/* enum: Disables telemetry functionality, returns the card to default
> > > > + * behaviour of the configured datapath variant.
> > > > + */
> > > > +#define MC_CMD_TELEMETRY_ENABLE_IN_DISABLE 0x0
> > > > +/* enum: Enables telemetry functionality on the currently configured datapath
> > > > + * variant if supported.
> > > > + */
> > > > +#define MC_CMD_TELEMETRY_ENABLE_IN_ENABLE 0x1
> > > > +
> > > > +/* MC_CMD_TELEMETRY_ENABLE_OUT msgresponse */
> > > > +#define MC_CMD_TELEMETRY_ENABLE_OUT_LEN 0
> > > > +
> > > > +/* TELEMETRY_CONFIG structuredef */
> > > > +#define TELEMETRY_CONFIG_LEN 36
> > > > +/* Bitfields to identify the list of config parameters included in the command.
> > > > + * A bit-value of 1 indicates that the relevant config parameter field is
> > > > + * valid; 0 indicates invalid and the config parameter field must be ignored by
> > > > + * firmware. Firmware may however apply some default values for certain
> > > > + * parameters.
> > > > + */
> > > > +#define TELEMETRY_CONFIG_FLAGS_OFST 0
> > > > +#define TELEMETRY_CONFIG_FLAGS_LEN 4
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_OFST 0
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_LBN 0
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_VALID_WIDTH 1
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_OFST 0
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_LBN 1
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_VALID_WIDTH 1
> > > > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_OFST 0
> > > > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_LBN 2
> > > > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_VALID_WIDTH 1
> > > > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_OFST 0
> > > > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_LBN 3
> > > > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_VALID_WIDTH 1
> > > > +#define TELEMETRY_CONFIG_RESERVED1_OFST 0
> > > > +#define TELEMETRY_CONFIG_RESERVED1_LBN 4
> > > > +#define TELEMETRY_CONFIG_RESERVED1_WIDTH 28
> > > > +#define TELEMETRY_CONFIG_FLAGS_LBN 0
> > > > +#define TELEMETRY_CONFIG_FLAGS_WIDTH 32
> > > > +/* Collector IPv4/IPv6 address to which latency measurements are forwarded from
> > > > + * the adapter (as bytes in network order; set last 12 bytes to 0 for IPv4
> > > > + * address).
> > > > + */
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_OFST 4
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_LEN 16
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_LBN 32
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_IP_WIDTH 128
> > > > +/* Collector Port number to which latency measurements are forwarded from the
> > > > + * adapter (as bytes in network order).
> > > > + */
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_OFST 20
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_LEN 2
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_LBN 160
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_PORT_WIDTH 16
> > > > +/* Unused - set to 0. */
> > > > +#define TELEMETRY_CONFIG_RESERVED2_OFST 22
> > > > +#define TELEMETRY_CONFIG_RESERVED2_LEN 2
> > > > +#define TELEMETRY_CONFIG_RESERVED2_LBN 176
> > > > +#define TELEMETRY_CONFIG_RESERVED2_WIDTH 16
> > > > +/* MAC address of the collector (as bytes in network order). */
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_OFST 24
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_LEN 6
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_LBN 192
> > > > +#define TELEMETRY_CONFIG_METRICS_COLLECTOR_MAC_ADDR_WIDTH 48
> > > > +/* Maximum number of latency measurements to be made on a telemetry flow. */
> > > > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_OFST 30
> > > > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_LEN 2
> > > > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_LBN 240
> > > > +#define TELEMETRY_CONFIG_MAX_METRICS_COUNT_WIDTH 16
> > > > +/* Maximum duration for which a telemetry flow is monitored (in millisecs). */
> > > > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_OFST 32
> > > > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_LEN 4
> > > > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_LBN 256
> > > > +#define TELEMETRY_CONFIG_MONITOR_TIMEOUT_MS_WIDTH 32
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_TELEMETRY_CONFIG
> > > > + * This top-level command includes various sub-opcodes that are used to apply
> > > > + * (and read-back) telemetry related configuration parameters on the NIC.
> > > > + * Reference - SF-120569-SW Telemetry Firmware Design.
> > > > + */
> > > > +#define MC_CMD_TELEMETRY_CONFIG 0x139
> > > > +#undef MC_CMD_0x139_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x139_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_TELEMETRY_CONFIG_IN msgrequest */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_LEN 4
> > > > +/* Telemetry configuration sub-operation code */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_OP_OFST 0
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_OP_LEN 4
> > > > +/* enum: Configure parameters for telemetry measurements. */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_OP_SET 0x1
> > > > +/* enum: Read current values of parameters for telemetry measurements. */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_OP_GET 0x2
> > > > +
> > > > +/* MC_CMD_TELEMETRY_CONFIG_IN_SET msgrequest: This command configures the
> > > > + * parameters necessary for tcp-latency measurements. The adapter adds a filter
> > > > + * for every new tcp flow seen in both tx and rx directions and tracks the
> > > > + * telemetry measurements related to the flow in a tracking table. Entries in
> > > > + * the tracking table live as long as N measurements are made on the flow or
> > > > + * the flow has been in the tracking table for the maximum configured duration.
> > > > + * Telemetry measurements in this command refer to tcp-latency measurements for
> > > > + * data-to-ack latency as well as data-to-data latency. All telemetry
> > > > + * measurements are bundled into a UDP packet and forwarded to a collector
> > > > + * whose IP address is configured using this command.
> > > > + */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_LEN 40
> > > > +/* Telemetry configuration sub-operation code. Must be set to
> > > > + * MC_CMD_TELEMETRY_CONFIG_OP_SET.
> > > > + */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_OP_OFST 0
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_OP_LEN 4
> > > > +/* struct of type TELEMETRY_CONFIG. */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_PARAMETERS_OFST 4
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_SET_PARAMETERS_LEN 36
> > > > +
> > > > +/* MC_CMD_TELEMETRY_CONFIG_OUT_SET msgresponse */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_OUT_SET_LEN 0
> > > > +
> > > > +/* MC_CMD_TELEMETRY_CONFIG_IN_GET msgrequest: This command reads out the
> > > > + * current values of config parameters necessary for tcp-latency measurements.
> > > > + * See MC_CMD_TELEMETRY_SET_CONFIG for more information about the configuration
> > > > + * parameters.
> > > > + */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_GET_LEN 4
> > > > +/* Telemetry configuration sub-operation code. Must be set to
> > > > + * MC_CMD_TELEMETRY_CONFIG_OP_GET.
> > > > + */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_GET_OP_OFST 0
> > > > +#define MC_CMD_TELEMETRY_CONFIG_IN_GET_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_TELEMETRY_CONFIG_OUT_GET msgresponse */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_LEN 36
> > > > +/* struct of type TELEMETRY_CONFIG. */
> > > > +#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_PARAMETERS_OFST 0
> > > > +#define MC_CMD_TELEMETRY_CONFIG_OUT_GET_PARAMETERS_LEN 36
> > > > +
> > > > +
> > > > /***********************************/
> > > > /* MC_CMD_GET_RX_PREFIX_ID
> > > > * This command is part of the mechanism for configuring the format of the RX
> > > > @@ -23832,6 +27337,427 @@
> > > > #define MC_CMD_GET_NCSI_INFO_STATISTICS_OUT_AENS_SENT_OFST 24
> > > > #define MC_CMD_GET_NCSI_INFO_STATISTICS_OUT_AENS_SENT_LEN 4
> > > >
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_FIRMWARE_SET_LOCKDOWN
> > > > + * System lockdown, when enabled firmware updates are blocked.
> > > > + */
> > > > +#define MC_CMD_FIRMWARE_SET_LOCKDOWN 0x16f
> > > > +#undef MC_CMD_0x16f_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x16f_PRIVILEGE_CTG SRIOV_CTG_ADMIN
> > > > +
> > > > +/* MC_CMD_FIRMWARE_SET_LOCKDOWN_IN msgrequest: This MCDI command is to enable
> > > > + * only because lockdown can only be disabled by a PMCI command or a cold reset
> > > > + * of the system.
> > > > + */
> > > > +#define MC_CMD_FIRMWARE_SET_LOCKDOWN_IN_LEN 0
> > > > +
> > > > +/* MC_CMD_FIRMWARE_SET_LOCKDOWN_OUT msgresponse */
> > > > +#define MC_CMD_FIRMWARE_SET_LOCKDOWN_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_GET_TEST_FEATURES
> > > > + * This command returns device details knowledge of which may be required by
> > > > + * test infrastructure. Although safe, it is not intended to be used by
> > > > + * production drivers, and the structure returned intentionally has no public
> > > > + * documentation.
> > > > + */
> > > > +#define MC_CMD_GET_TEST_FEATURES 0x1ac
> > > > +#undef MC_CMD_0x1ac_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x1ac_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > > > +
> > > > +/* MC_CMD_GET_TEST_FEATURES_IN msgrequest: Request test features. */
> > > > +#define MC_CMD_GET_TEST_FEATURES_IN_LEN 0
> > > > +
> > > > +/* MC_CMD_GET_TEST_FEATURE_OUT msgresponse */
> > > > +#define MC_CMD_GET_TEST_FEATURE_OUT_LENMIN 4
> > > > +#define MC_CMD_GET_TEST_FEATURE_OUT_LENMAX 252
> > > > +#define MC_CMD_GET_TEST_FEATURE_OUT_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_GET_TEST_FEATURE_OUT_LEN(num) (0+4*(num))
> > > > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_NUM(len) (((len)-0)/4)
> > > > +/* Test-specific NIC information. Production drivers must treat this as opaque.
> > > > + * The layout is defined in the private TEST_FEATURES_LAYOUT structure.
> > > > + */
> > > > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_OFST 0
> > > > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_LEN 4
> > > > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MINNUM 1
> > > > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MAXNUM 63
> > > > +#define MC_CMD_GET_TEST_FEATURE_OUT_TEST_FEATURES_MAXNUM_MCDI2 255
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_FPGA
> > > > + * A command to perform various fpga-related operations on platforms that
> > > > + * include FPGAs. Note that some platforms may only support a subset of these
> > > > + * operations.
> > > > + */
> > > > +#define MC_CMD_FPGA 0x1bf
> > > > +#undef MC_CMD_0x1bf_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x1bf_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > > > +
> > > > +/* MC_CMD_FPGA_IN msgrequest */
> > > > +#define MC_CMD_FPGA_IN_LEN 4
> > > > +/* Sub-command code */
> > > > +#define MC_CMD_FPGA_IN_OP_OFST 0
> > > > +#define MC_CMD_FPGA_IN_OP_LEN 4
> > > > +/* enum: Get the FPGA version string. */
> > > > +#define MC_CMD_FPGA_IN_OP_GET_VERSION 0x0
> > > > +/* enum: Read bitmask of features supported in the FPGA image. */
> > > > +#define MC_CMD_FPGA_IN_OP_GET_CAPABILITIES 0x1
> > > > +/* enum: Perform a FPGA reset. */
> > > > +#define MC_CMD_FPGA_IN_OP_RESET 0x2
> > > > +/* enum: Set active flash device. */
> > > > +#define MC_CMD_FPGA_IN_OP_SELECT_FLASH 0x3
> > > > +/* enum: Get active flash device. */
> > > > +#define MC_CMD_FPGA_IN_OP_GET_ACTIVE_FLASH 0x4
> > > > +/* enum: Configure internal link i.e. the FPGA port facing the ASIC. */
> > > > +#define MC_CMD_FPGA_IN_OP_SET_INTERNAL_LINK 0x5
> > > > +/* enum: Read internal link configuration. */
> > > > +#define MC_CMD_FPGA_IN_OP_GET_INTERNAL_LINK 0x6
> > > > +/* enum: Get MAC statistics of FPGA external port. */
> > > > +#define MC_CMD_FPGA_IN_OP_GET_MAC_STATS 0x7
> > > > +/* enum: Set configuration on internal FPGA MAC. */
> > > > +#define MC_CMD_FPGA_IN_OP_SET_INTERNAL_MAC 0x8
> > > > +
> > > > +/* MC_CMD_FPGA_OP_GET_VERSION_IN msgrequest: Get the FPGA version string. A
> > > > + * free-format string is returned in response to this command. Any checks on
> > > > + * supported FPGA operations are based on the response to
> > > > + * MC_CMD_FPGA_OP_GET_CAPABILITIES.
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_IN_LEN 4
> > > > +/* Sub-command code. Must be OP_GET_VERSION */
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_IN_OP_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_FPGA_OP_GET_VERSION_OUT msgresponse: Returns the version string. */
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMIN 0
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMAX 252
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_LEN(num) (0+1*(num))
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_NUM(len) (((len)-0)/1)
> > > > +/* Null-terminated string containing version information. */
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_LEN 1
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MINNUM 0
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MAXNUM 252
> > > > +#define MC_CMD_FPGA_OP_GET_VERSION_OUT_VERSION_MAXNUM_MCDI2 1020
> > > > +
> > > > +/* MC_CMD_FPGA_OP_GET_CAPABILITIES_IN msgrequest: Read bitmask of features
> > > > + * supported in the FPGA image.
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_LEN 4
> > > > +/* Sub-command code. Must be OP_GET_CAPABILITIES */
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_OP_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT msgresponse: Returns the version string.
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_LEN 4
> > > > +/* Bit-mask of supported features. */
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_CAPABILITIES_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_CAPABILITIES_LEN 4
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_LBN 0
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAC_WIDTH 1
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_LBN 1
> > > > +#define MC_CMD_FPGA_OP_GET_CAPABILITIES_OUT_MAE_WIDTH 1
> > > > +
> > > > +/* MC_CMD_FPGA_OP_RESET_IN msgrequest: Perform a FPGA reset operation where
> > > > + * supported.
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_RESET_IN_LEN 4
> > > > +/* Sub-command code. Must be OP_RESET */
> > > > +#define MC_CMD_FPGA_OP_RESET_IN_OP_OFST 0
> > > > +#define MC_CMD_FPGA_OP_RESET_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_FPGA_OP_RESET_OUT msgresponse */
> > > > +#define MC_CMD_FPGA_OP_RESET_OUT_LEN 0
> > > > +
> > > > +/* MC_CMD_FPGA_OP_SELECT_FLASH_IN msgrequest: Set active FPGA flash device.
> > > > + * Returns EINVAL if selected flash index does not exist on the platform under
> > > > + * test.
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_LEN 8
> > > > +/* Sub-command code. Must be OP_SELECT_FLASH */
> > > > +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_OP_OFST 0
> > > > +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_OP_LEN 4
> > > > +/* Flash device identifier. */
> > > > +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_FLASH_ID_OFST 4
> > > > +#define MC_CMD_FPGA_OP_SELECT_FLASH_IN_FLASH_ID_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MC_CMD_FPGA_FLASH_INDEX */
> > > > +
> > > > +/* MC_CMD_FPGA_OP_SELECT_FLASH_OUT msgresponse */
> > > > +#define MC_CMD_FPGA_OP_SELECT_FLASH_OUT_LEN 0
> > > > +
> > > > +/* MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN msgrequest: Get active FPGA flash device.
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_LEN 4
> > > > +/* Sub-command code. Must be OP_GET_ACTIVE_FLASH */
> > > > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_OP_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT msgresponse: Returns flash identifier
> > > > + * for current active flash.
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_LEN 4
> > > > +/* Flash device identifier. */
> > > > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_FLASH_ID_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_ACTIVE_FLASH_OUT_FLASH_ID_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MC_CMD_FPGA_FLASH_INDEX */
> > > > +
> > > > +/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN msgrequest: Configure FPGA internal
> > > > + * port, facing the ASIC
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LEN 12
> > > > +/* Sub-command code. Must be OP_SET_INTERNAL_LINK */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_OP_OFST 0
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_OP_LEN 4
> > > > +/* Flags */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLAGS_OFST 4
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLAGS_LEN 4
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_OFST 4
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_LBN 0
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_LINK_STATE_WIDTH 2
> > > > +/* enum: Unmodified, same as last state set by firmware */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_AUTO 0x0
> > > > +/* enum: Configure link-up */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_UP 0x1
> > > > +/* enum: Configure link-down */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_DOWN 0x2
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_OFST 4
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_LBN 2
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_FLUSH_WIDTH 1
> > > > +/* Link speed to be applied on FPGA internal port MAC. */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_SPEED_OFST 8
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN_SPEED_LEN 4
> > > > +
> > > > +/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_OUT msgresponse */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_LINK_OUT_LEN 0
> > > > +
> > > > +/* MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN msgrequest: Read FPGA internal port
> > > > + * configuration and status
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_LEN 4
> > > > +/* Sub-command code. Must be OP_GET_INTERNAL_LINK */
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_OP_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT msgresponse: Response format for read
> > > > + * FPGA internal port configuration and status
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LEN 8
> > > > +/* Flags */
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_FLAGS_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_FLAGS_LEN 4
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_LBN 0
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_LINK_STATE_WIDTH 2
> > > > +/* Enum values, see field(s): */
> > > > +/* MC_CMD_FPGA_OP_SET_INTERNAL_LINK_IN/FLAGS */
> > > > +/* Link speed set on FPGA internal port MAC. */
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_SPEED_OFST 4
> > > > +#define MC_CMD_FPGA_OP_GET_INTERNAL_LINK_OUT_SPEED_LEN 4
> > > > +
> > > > +/* MC_CMD_FPGA_OP_GET_MAC_STATS_IN msgrequest: Get FPGA external port MAC
> > > > + * statistics.
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_LEN 4
> > > > +/* Sub-command code. Must be OP_GET_MAC_STATS. */
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_OP_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_IN_OP_LEN 4
> > > > +
> > > > +/* MC_CMD_FPGA_OP_GET_MAC_STATS_OUT msgresponse */
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMIN 4
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMAX 252
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LENMAX_MCDI2 1020
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_LEN(num) (4+8*(num))
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_NUM(len) (((len)-4)/8)
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_NUM_STATS_OFST 0
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_NUM_STATS_LEN 4
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_OFST 4
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LEN 8
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_OFST 4
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_LEN 4
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_LBN 32
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_LO_WIDTH 32
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_OFST 8
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_LEN 4
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_LBN 64
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_HI_WIDTH 32
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MINNUM 0
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MAXNUM 31
> > > > +#define MC_CMD_FPGA_OP_GET_MAC_STATS_OUT_STATISTICS_MAXNUM_MCDI2 127
> > > > +#define MC_CMD_FPGA_MAC_TX_TOTAL_PACKETS 0x0 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_TX_TOTAL_BYTES 0x1 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_TX_TOTAL_GOOD_PACKETS 0x2 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_TX_TOTAL_GOOD_BYTES 0x3 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_TX_BAD_FCS 0x4 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_TX_PAUSE 0x5 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_TX_USER_PAUSE 0x6 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_RX_TOTAL_PACKETS 0x7 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_RX_TOTAL_BYTES 0x8 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_RX_TOTAL_GOOD_PACKETS 0x9 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_RX_TOTAL_GOOD_BYTES 0xa /* enum */
> > > > +#define MC_CMD_FPGA_MAC_RX_BAD_FCS 0xb /* enum */
> > > > +#define MC_CMD_FPGA_MAC_RX_PAUSE 0xc /* enum */
> > > > +#define MC_CMD_FPGA_MAC_RX_USER_PAUSE 0xd /* enum */
> > > > +#define MC_CMD_FPGA_MAC_RX_UNDERSIZE 0xe /* enum */
> > > > +#define MC_CMD_FPGA_MAC_RX_OVERSIZE 0xf /* enum */
> > > > +#define MC_CMD_FPGA_MAC_RX_FRAMING_ERR 0x10 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_FEC_UNCORRECTED_ERRORS 0x11 /* enum */
> > > > +#define MC_CMD_FPGA_MAC_FEC_CORRECTED_ERRORS 0x12 /* enum */
> > > > +
> > > > +/* MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN msgrequest: Configures the internal port
> > > > + * MAC on the FPGA.
> > > > + */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_LEN 20
> > > > +/* Sub-command code. Must be OP_SET_INTERNAL_MAC. */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_OP_OFST 0
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_OP_LEN 4
> > > > +/* Select which parameters to configure. */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CONTROL_OFST 4
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CONTROL_LEN 4
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_OFST 4
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_LBN 0
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_MTU_WIDTH 1
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_OFST 4
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_LBN 1
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_DRAIN_WIDTH 1
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_OFST 4
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_LBN 2
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_CFG_FCNTL_WIDTH 1
> > > > +/* The MTU to be programmed into the MAC. */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_MTU_OFST 8
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_MTU_LEN 4
> > > > +/* Drain Tx FIFO */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_DRAIN_OFST 12
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_DRAIN_LEN 4
> > > > +/* flow control configuration. See MC_CMD_SET_MAC/MC_CMD_SET_MAC_IN/FCNTL. */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_FCNTL_OFST 16
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_IN_FCNTL_LEN 4
> > > > +
> > > > +/* MC_CMD_FPGA_OP_SET_INTERNAL_MAC_OUT msgresponse */
> > > > +#define MC_CMD_FPGA_OP_SET_INTERNAL_MAC_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE
> > > > + * This command is expected to be used on a U25 board with an MAE in the FPGA.
> > > > + * It does not modify the operational state of the NIC. The modes are described
> > > > + * in XN-200039-TC - U25 OVS packet formats.
> > > > + */
> > > > +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE 0x1c0
> > > > +#undef MC_CMD_0x1c0_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x1c0_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > > > +
> > > > +/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_IN msgrequest */
> > > > +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_IN_LEN 0
> > > > +
> > > > +/* MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT msgresponse */
> > > > +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_LEN 4
> > > > +/* The current link mode */
> > > > +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_MODE_OFST 0
> > > > +#define MC_CMD_EXTERNAL_MAE_GET_LINK_MODE_OUT_MODE_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MC_CMD_EXTERNAL_MAE_LINK_MODE */
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE
> > > > + * This command is expected to be used on a U25 board with an MAE in the FPGA.
> > > > + * The modes are described in XN-200039-TC - U25 OVS packet formats. This
> > > > + * command will set the link between the FPGA and the X2 to the specified new
> > > > + * mode. It will first enter bootstrap mode, make sure there are no packets in
> > > > + * flight and then enter the requested mode. In order to make sure there are no
> > > > + * packets in flight, it will flush the X2 TX path, the FPGA RX path from the
> > > > + * X2, the FPGA TX path to the X2 and the X2 RX path. The driver is responsible
> > > > + * for making sure there are no TX or RX descriptors posted on any TXQ or RXQ
> > > > + * associated with the affected port before invoking this command. This command
> > > > + * is run implicitly with MODE set to LEGACY when MC_CMD_DRV_ATTACH is
> > > > + * executed.
> > > > + */
> > > > +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE 0x1c1
> > > > +#undef MC_CMD_0x1c1_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x1c1_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > > > +
> > > > +/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN msgrequest */
> > > > +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_LEN 4
> > > > +/* The new link mode. */
> > > > +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_MODE_OFST 0
> > > > +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_IN_MODE_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MC_CMD_EXTERNAL_MAE_LINK_MODE */
> > > > +
> > > > +/* MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_OUT msgresponse */
> > > > +#define MC_CMD_EXTERNAL_MAE_SET_LINK_MODE_OUT_LEN 0
> > > > +
> > > > +
> > > > +/***********************************/
> > > > +/* MC_CMD_GET_BUFTBL_STATS
> > > > + * Currently EF10 only. Read usage and limits for Buffer Table
> > > > + */
> > > > +#define MC_CMD_GET_BUFTBL_STATS 0x6a
> > > > +#undef MC_CMD_0x6a_PRIVILEGE_CTG
> > > > +
> > > > +#define MC_CMD_0x6a_PRIVILEGE_CTG SRIOV_CTG_GENERAL
> > > > +
> > > > +/* MC_CMD_GET_BUFTBL_STATS_IN msgrequest */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_IN_LEN 0
> > > > +
> > > > +/* MC_CMD_GET_BUFTBL_STATS_OUT msgresponse */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_LEN 40
> > > > +/* number of buffer table entries per set */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_SET_OFST 0
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_SET_LEN 4
> > > > +/* number of buffer table entries per cluster */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_CLUSTER_OFST 4
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_ENTRIES_PER_CLUSTER_LEN 4
> > > > +/* Maximum size buffer table can grow to, in clusters. On EF10, this can
> > > > + * potentially vary depending on the size of the Descriptor Cache.
> > > > + */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MAX_CLUSTERS_OFST 8
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MAX_CLUSTERS_LEN 4
> > > > +/* High water mark for number of buffer table clusters which have been
> > > > + * allocated.
> > > > + */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HIGH_WATER_CLUSTERS_OFST 12
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HIGH_WATER_CLUSTERS_LEN 4
> > > > +/* Number of free buffer table clusters on the free cluster list. */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_CLUSTERS_OFST 16
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_CLUSTERS_LEN 4
> > > > +/* Number of free buffer table sets on the free set list. */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_SETS_OFST 20
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_FREE_SETS_LEN 4
> > > > +/* Number of chunks of fully-used clusters allocated to the MC for EVQ, RXQ and
> > > > + * TXQs.
> > > > + */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_FULL_CLUSTERS_OFST 24
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_FULL_CLUSTERS_LEN 4
> > > > +/* Number of chunks in partially-used clusters allocated to the MC for EVQ, RXQ
> > > > + * and TXQs.
> > > > + */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_PART_CLUSTERS_OFST 28
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_MC_PART_CLUSTERS_LEN 4
> > > > +/* Number of buffer table sets (chunks) allocated to the host via
> > > > + * MC_CMD_ALLOC_BUFTBL_CHUNK.
> > > > + */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HOST_SETS_OFST 32
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_BUFTBL_HOST_SETS_LEN 4
> > > > +/* Maximum number of VIs per NIC. On EF10 this is the current value as used to
> > > > + * size the Descriptor Cache in hardware.
> > > > + */
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_VI_MAX_OFST 36
> > > > +#define MC_CMD_GET_BUFTBL_STATS_OUT_VI_MAX_LEN 4
> > > > +
> > > > /* CLIENT_HANDLE structuredef: A client is an abstract entity that can make
> > > > * requests of the device and that can own resources managed by the device.
> > > > * Examples of clients include PCIe functions and dynamic clients. A client
> > > > @@ -23899,8 +27825,8 @@
> > > >
> > > > /* SCHED_CREDIT_CHECK_RESULT structuredef */
> > > > #define SCHED_CREDIT_CHECK_RESULT_LEN 16
> > > > -/* The instance of the scheduler. Refer to XN-200389-AW for the location of
> > > > - * these schedulers in the hardware.
> > > > +/* The instance of the scheduler. Refer to XN-200389-AW (snic/hnic) and
> > > > + * XN-200425-TC (cdx) for the location of these schedulers in the hardware.
> > > > */
> > > > #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_OFST 0
> > > > #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_LEN 1
> > > > @@ -23914,6 +27840,16 @@
> > > > #define SCHED_CREDIT_CHECK_RESULT_DMAC_H2C 0x7 /* enum */
> > > > #define SCHED_CREDIT_CHECK_RESULT_HUB_NET_B 0x8 /* enum */
> > > > #define SCHED_CREDIT_CHECK_RESULT_HUB_NET_REPLAY 0x9 /* enum */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_ADAPTER_C2H_C 0xa /* enum */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_A2_H2C_C 0xb /* enum */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_A3_SOFT_ADAPTOR_C 0xc /* enum */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_A4_DPU_WRITE_C 0xd /* enum */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_JRC_RRU 0xe /* enum */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_CDM_SINK 0xf /* enum */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_PCIE_SINK 0x10 /* enum */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_UPORT_SINK 0x11 /* enum */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_PSX_SINK 0x12 /* enum */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_A5_DPU_READ_C 0x13 /* enum */
> > > > #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_LBN 0
> > > > #define SCHED_CREDIT_CHECK_RESULT_SCHED_INSTANCE_WIDTH 8
> > > > /* The type of node that this result refers to. */
> > > > @@ -23923,6 +27859,10 @@
> > > > #define SCHED_CREDIT_CHECK_RESULT_DEST 0x0
> > > > /* enum: Source node */
> > > > #define SCHED_CREDIT_CHECK_RESULT_SOURCE 0x1
> > > > +/* enum: Destination node credit type 1 (new to the Keystone schedulers, see
> > > > + * SF-120268-TC)
> > > > + */
> > > > +#define SCHED_CREDIT_CHECK_RESULT_DEST_CREDIT1 0x2
> > > > #define SCHED_CREDIT_CHECK_RESULT_NODE_TYPE_LBN 8
> > > > #define SCHED_CREDIT_CHECK_RESULT_NODE_TYPE_WIDTH 8
> > > > /* Level of node in scheduler hierarchy (level 0 is the bottom of the
> > > > @@ -26076,6 +30016,26 @@
> > > > #define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MINNUM 0
> > > > #define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MAXNUM 4
> > > > #define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_MAXNUM_MCDI2 19
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_OFST 4
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LEN 8
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_OFST 4
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_LEN 4
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_LBN 32
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_LO_WIDTH 32
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_OFST 8
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_LEN 4
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_LBN 64
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_HI_WIDTH 32
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_PF_OFST 4
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_PF_LEN 2
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_VF_OFST 6
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_VF_LEN 2
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_INTF_OFST 8
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_FUNC_INTF_LEN 4
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_PERSONALITY_OFST 12
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_PERSONALITY_LEN 4
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_LABEL_OFST 16
> > > > +#define MC_CMD_DESC_PROXY_FUNC_ENUM_OUT_FUNC_MAP_LABEL_LEN 40
> > > >
> > > >
> > > > /***********************************/
> > > > @@ -27350,7 +31310,7 @@
> > > > /* MAE_MPORT_SELECTOR structuredef: MPORTS are identified by an opaque unsigned
> > > > * integer value (mport_id) that is guaranteed to be representable within
> > > > * 32-bits or within any NIC interface field that needs store the value
> > > > - * (whichever is narrowers). This selector structure provides a stable way to
> > > > + * (whichever is narrower). This selector structure provides a stable way to
> > > > * refer to m-ports.
> > > > */
> > > > #define MAE_MPORT_SELECTOR_LEN 4
> > > > @@ -27425,10 +31385,22 @@
> > > > #define MAE_MPORT_SELECTOR_FLAT_WIDTH 32
> > > >
> > > > /* MAE_LINK_ENDPOINT_SELECTOR structuredef: Structure that identifies a real or
> > > > - * virtual network port by MAE port and link end
> > > > + * virtual network port by MAE port and link end. Intended to be used by
> > > > + * network port MCDI commands. Setting FLAT to MAE_LINK_ENDPOINT_COMPAT is
> > > > + * equivalent to using the previous version of the command. Not all possible
> > > > + * combinations of MPORT_END and MPORT_SELECTOR in MAE_LINK_ENDPOINT_SELECTOR
> > > > + * will work in all circumstances. 1. Some will always work (e.g. a VF can
> > > > + * always address its logical MAC using MPORT_SELECTOR=ASSIGNED,LINK_END=VNIC),
> > > > + * 2. Some are not meaningful and will always fail with EINVAL (e.g. attempting
> > > > + * to address the VNIC end of a link to a physical port), 3. Some are
> > > > + * meaningful but require the MCDI client to have the required permission and
> > > > + * fail with EPERM otherwise (e.g. trying to set the MAC on a VF the caller
> > > > + * cannot administer), and 4. Some could be implementation-specific and fail
> > > > + * with ENOTSUP if not available (no examples exist right now). See
> > > > + * SF-123581-TC section 4.3 for more details.
> > > > */
> > > > #define MAE_LINK_ENDPOINT_SELECTOR_LEN 8
> > > > -/* The MAE MPORT of interest */
> > > > +/* Identifier for the MAE MPORT of interest */
> > > > #define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_OFST 0
> > > > #define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_LEN 4
> > > > #define MAE_LINK_ENDPOINT_SELECTOR_MPORT_SELECTOR_LBN 0
> > > > @@ -27829,6 +31801,8 @@
> > > > #define MC_CMD_MAE_COUNTER_ALLOC_OUT_COUNTER_ID_MAXNUM_MCDI2 253
> > > > /* enum: A counter ID that is guaranteed never to represent a real counter */
> > > > #define MC_CMD_MAE_COUNTER_ALLOC_OUT_COUNTER_ID_NULL 0xffffffff
> > > > +/* Other enum values, see field(s): */
> > > > +/* MAE_COUNTER_ID */
> > > >
> > > >
> > > > /***********************************/
> > > > @@ -28266,6 +32240,24 @@
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_OFST 0
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_LBN 14
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_LBN 15
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_LBN 16
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_LBN 18
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DO_SET_NET_CHAN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_LBN 19
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_PLUGIN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_LBN 20
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_IN_LACP_INC_L4_WIDTH 1
> > > > /* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_VLAN0_TCI_BE_OFST 4
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_VLAN0_TCI_BE_LEN 2
> > > > @@ -28291,19 +32283,23 @@
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DELIVER_OFST 20
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_DELIVER_LEN 4
> > > > /* Allows an action set to trigger several counter updates. Set to
> > > > - * COUNTER_LIST_ID_NULL to request no counter action.
> > > > + * MAE_COUNTER_ID_NULL to request no counter action.
> > > > */
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_LIST_ID_OFST 24
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_LIST_ID_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MAE_COUNTER_ID */
> > > > /* If a driver only wished to update one counter within this action set, then
> > > > * it can supply a COUNTER_ID instead of allocating a single-element counter
> > > > * list. The ID must have been allocated with COUNTER_TYPE=AR. This field
> > > > - * should be set to COUNTER_ID_NULL if this behaviour is not required. It is
> > > > - * not valid to supply a non-NULL value for both COUNTER_LIST_ID and
> > > > + * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
> > > > + * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
> > > > * COUNTER_ID.
> > > > */
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_ID_OFST 28
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_COUNTER_ID_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MAE_COUNTER_ID */
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_MARK_VALUE_OFST 32
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_IN_MARK_VALUE_LEN 4
> > > > /* Set to MAC_ID_NULL to request no source MAC replacement. */
> > > > @@ -28347,6 +32343,24 @@
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_OFST 0
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_LBN 14
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_LBN 15
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_LBN 16
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_LBN 18
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DO_SET_NET_CHAN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_LBN 19
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_PLUGIN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_LBN 20
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_LACP_INC_L4_WIDTH 1
> > > > /* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_VLAN0_TCI_BE_OFST 4
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_VLAN0_TCI_BE_LEN 2
> > > > @@ -28372,19 +32386,23 @@
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DELIVER_OFST 20
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_DELIVER_LEN 4
> > > > /* Allows an action set to trigger several counter updates. Set to
> > > > - * COUNTER_LIST_ID_NULL to request no counter action.
> > > > + * MAE_COUNTER_ID_NULL to request no counter action.
> > > > */
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_LIST_ID_OFST 24
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_LIST_ID_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MAE_COUNTER_ID */
> > > > /* If a driver only wished to update one counter within this action set, then
> > > > * it can supply a COUNTER_ID instead of allocating a single-element counter
> > > > * list. The ID must have been allocated with COUNTER_TYPE=AR. This field
> > > > - * should be set to COUNTER_ID_NULL if this behaviour is not required. It is
> > > > - * not valid to supply a non-NULL value for both COUNTER_LIST_ID and
> > > > + * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
> > > > + * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
> > > > * COUNTER_ID.
> > > > */
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_ID_OFST 28
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_COUNTER_ID_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MAE_COUNTER_ID */
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_MARK_VALUE_OFST 32
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_MARK_VALUE_LEN 4
> > > > /* Set to MAC_ID_NULL to request no source MAC replacement. */
> > > > @@ -28437,6 +32455,172 @@
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_ECN_ECT_1_TO_CE_LBN 6
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_V2_IN_ECN_ECT_1_TO_CE_WIDTH 1
> > > >
> > > > +/* MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN msgrequest: Only supported if
> > > > + * MAE_ACTION_SET_ALLOC_V3_SUPPORTED is advertised in
> > > > + * MC_CMD_GET_CAPABILITIES_V10_OUT.
> > > > + */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LEN 53
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAGS_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAGS_LEN 4
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_LBN 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_PUSH_WIDTH 2
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_LBN 4
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN_POP_WIDTH 2
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_LBN 8
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DECAP_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_LBN 9
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_LBN 10
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_FLAG_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_LBN 11
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_NAT_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_LBN 12
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DECR_IP_TTL_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_LBN 13
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_SRC_MPORT_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_LBN 14
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SUPPRESS_SELF_DELIVERY_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_LBN 15
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_C_PL_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_LBN 16
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_D_PL_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_LBN 17
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_RDP_OUT_HOST_CHAN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_LBN 18
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_SET_NET_CHAN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_LBN 19
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_PLUGIN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_OFST 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_LBN 20
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_LACP_INC_L4_WIDTH 1
> > > > +/* If VLAN_PUSH >= 1, TCI value to be inserted as outermost VLAN. */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_TCI_BE_OFST 4
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_TCI_BE_LEN 2
> > > > +/* If VLAN_PUSH >= 1, TPID value to be inserted as outermost VLAN. */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_PROTO_BE_OFST 6
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN0_PROTO_BE_LEN 2
> > > > +/* If VLAN_PUSH == 2, inner TCI value to be inserted. */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_TCI_BE_OFST 8
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_TCI_BE_LEN 2
> > > > +/* If VLAN_PUSH == 2, inner TPID value to be inserted. */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_PROTO_BE_OFST 10
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_VLAN1_PROTO_BE_LEN 2
> > > > +/* Reserved. Ignored by firmware. Should be set to zero or 0xffffffff. */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RSVD_OFST 12
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RSVD_LEN 4
> > > > +/* Set to ENCAP_HEADER_ID_NULL to request no encap action */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ENCAP_HEADER_ID_OFST 16
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ENCAP_HEADER_ID_LEN 4
> > > > +/* An m-port selector identifying the m-port that the modified packet should be
> > > > + * delivered to. Set to MPORT_SELECTOR_NULL to request no delivery of the
> > > > + * packet.
> > > > + */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DELIVER_OFST 20
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DELIVER_LEN 4
> > > > +/* Allows an action set to trigger several counter updates. Set to
> > > > + * MAE_COUNTER_ID_NULL to request no counter action.
> > > > + */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_LIST_ID_OFST 24
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_LIST_ID_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MAE_COUNTER_ID */
> > > > +/* If a driver only wished to update one counter within this action set, then
> > > > + * it can supply a COUNTER_ID instead of allocating a single-element counter
> > > > + * list. The ID must have been allocated with COUNTER_TYPE=AR. This field
> > > > + * should be set to MAE_COUNTER_ID_NULL if this behaviour is not required. It
> > > > + * is not valid to supply a non-NULL value for both COUNTER_LIST_ID and
> > > > + * COUNTER_ID.
> > > > + */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_ID_OFST 28
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_COUNTER_ID_LEN 4
> > > > +/* Enum values, see field(s): */
> > > > +/* MAE_COUNTER_ID */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_VALUE_OFST 32
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_MARK_VALUE_LEN 4
> > > > +/* Set to MAC_ID_NULL to request no source MAC replacement. */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SRC_MAC_ID_OFST 36
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_SRC_MAC_ID_LEN 4
> > > > +/* Set to MAC_ID_NULL to request no destination MAC replacement. */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DST_MAC_ID_OFST 40
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DST_MAC_ID_LEN 4
> > > > +/* Source m-port ID to be reported for DO_SET_SRC_MPORT action. */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_REPORTED_SRC_MPORT_OFST 44
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_REPORTED_SRC_MPORT_LEN 4
> > > > +/* Actions for modifying the Differentiated Services Code-Point (DSCP) bits
> > > > + * within IPv4 and IPv6 headers.
> > > > + */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_CONTROL_OFST 48
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_CONTROL_LEN 2
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_OFST 48
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_LBN 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_ENCAP_COPY_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_OFST 48
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_LBN 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_DSCP_DECAP_COPY_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_OFST 48
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_LBN 2
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_DSCP_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_OFST 48
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_LBN 3
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DSCP_VALUE_WIDTH 6
> > > > +/* Actions for modifying the Explicit Congestion Notification (ECN) bits within
> > > > + * IPv4 and IPv6 headers.
> > > > + */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_CONTROL_OFST 50
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_CONTROL_LEN 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_OFST 50
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_LBN 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_ENCAP_COPY_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_OFST 50
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_LBN 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_ECN_DECAP_COPY_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_OFST 50
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_LBN 2
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_DO_REPLACE_ECN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_OFST 50
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_LBN 3
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_VALUE_WIDTH 2
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_OFST 50
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_LBN 5
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_0_TO_CE_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_OFST 50
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_LBN 6
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_ECN_ECT_1_TO_CE_WIDTH 1
> > > > +/* Actions for overwriting CH_ROUTE subfields. */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OVERWRITE_OFST 51
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OVERWRITE_LEN 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_OFST 51
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_LBN 0
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_C_PL_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_OFST 51
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_LBN 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_D_PL_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_OFST 51
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_LBN 2
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_PL_CHAN_WIDTH 1
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_OFST 51
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_LBN 3
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_RDP_OUT_HOST_CHAN_WIDTH 1
> > > > +/* Override outgoing CH_VC to network port for DO_SET_NET_CHAN action. Cannot
> > > > + * be used in conjunction with DO_SET_SRC_MPORT action.
> > > > + */
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_NET_CHAN_OFST 52
> > > > +#define MC_CMD_MAE_ACTION_SET_ALLOC_V3_IN_NET_CHAN_LEN 1
> > > > +
> > > > /* MC_CMD_MAE_ACTION_SET_ALLOC_OUT msgresponse */
> > > > #define MC_CMD_MAE_ACTION_SET_ALLOC_OUT_LEN 4
> > > > /* The MSB of the AS_ID is guaranteed to be clear if the ID is not
> > > > diff --git a/drivers/net/ethernet/sfc/mcdi_vdpa.c b/drivers/net/ethernet/sfc/mcdi_vdpa.c
> > > > index b9668545ca01..f9ee61b84320 100644
> > > > --- a/drivers/net/ethernet/sfc/mcdi_vdpa.c
> > > > +++ b/drivers/net/ethernet/sfc/mcdi_vdpa.c
> > > > @@ -14,14 +14,6 @@
> > > > #include "mcdi_vdpa.h"
> > > > #include "mcdi_pcol.h"
> > > >
> > > > -/* The value of target_vf in virtio MC commands like
> > > > - * virtqueue create, delete and get doorbell offset should
> > > > - * contain the VF index when the calling function is a PF
> > > > - * and VF_NULL (0xFFFF) otherwise. As the vDPA driver invokes
> > > > - * MC commands in context of the VF, it uses VF_NULL.
> > > > - */
> > > > -#define MC_CMD_VIRTIO_TARGET_VF_NULL 0xFFFF
> > > > -
> > > > struct efx_vring_ctx *efx_vdpa_vring_init(struct efx_nic *efx, u32 vi,
> > > > enum ef100_vdpa_vq_type vring_type)
> > > > {
> > > > @@ -47,7 +39,7 @@ struct efx_vring_ctx *efx_vdpa_vring_init(struct efx_nic *efx, u32 vi,
> > > > }
> > > >
> > > > vring_ctx->efx = efx;
> > > > - vring_ctx->vf_index = MC_CMD_VIRTIO_TARGET_VF_NULL;
> > > > + vring_ctx->vf_index = MC_CMD_VIRTIO_INIT_QUEUE_REQ_VF_NULL;
> > > > vring_ctx->vi_index = vi;
> > > > vring_ctx->mcdi_vring_type = queue_cmd;
> > > > return vring_ctx;

2023-03-14 08:39:38

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 04/14] sfc: evaluate vdpa support based on FW capability CLIENT_CMD_VF_PROXY

On Mon, Mar 13, 2023 at 06:09:19PM +0530, Gautam Dawar wrote:
>
> On 3/10/23 10:34, Jason Wang wrote:
> > Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> >
> >
> > On Tue, Mar 7, 2023 at 7:37 PM Gautam Dawar <[email protected]> wrote:
> > > Add and update vdpa_supported field to struct efx_nic to true if
> > > running Firmware supports CLIENT_CMD_VF_PROXY capability. This is
> > > required to ensure DMA isolation between MCDI command buffer and guest
> > > buffers.
> > >
> > > Signed-off-by: Gautam Dawar <[email protected]>
> > > ---
> > > drivers/net/ethernet/sfc/ef100_netdev.c | 26 +++++++++++++++---
> > > drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++----------------
> > > drivers/net/ethernet/sfc/ef100_nic.h | 6 +++--
> > > drivers/net/ethernet/sfc/ef100_vdpa.h | 5 ++--
> > > 4 files changed, 41 insertions(+), 31 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c
> > > index d916877b5a9a..5d93e870d9b7 100644
> > > --- a/drivers/net/ethernet/sfc/ef100_netdev.c
> > > +++ b/drivers/net/ethernet/sfc/ef100_netdev.c
> > > @@ -355,6 +355,28 @@ void ef100_remove_netdev(struct efx_probe_data *probe_data)
> > > efx->state = STATE_PROBED;
> > > }
> > >
> > > +static void efx_ef100_update_tso_features(struct efx_nic *efx)
> > > +{
> > > + struct ef100_nic_data *nic_data = efx->nic_data;
> > > + struct net_device *net_dev = efx->net_dev;
> > > + netdev_features_t tso;
> > > +
> > > + if (!efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3))
> > > + return;
> > > +
> > > + tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
> > > + NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
> > > + NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
> > > +
> > > + net_dev->features |= tso;
> > > + net_dev->hw_features |= tso;
> > > + net_dev->hw_enc_features |= tso;
> > > + /* EF100 HW can only offload outer checksums if they are UDP,
> > > + * so for GRE_CSUM we have to use GSO_PARTIAL.
> > > + */
> > > + net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
> > > +}
> > I don't see a direct relationship between vDPA and the TSO capability.
> > Is this an independent fix?
> This isn't actually fixing any issue. This a minor code refactoring that
> wraps-up updating of the TSO capabilities in a separate function for better
> readability.

There definity was an issue here: the vDPA code now needs access to the NIC
capabilities. For this is should use the efx_ef100_init_datapath_caps below,
but that was also doing this netdev specific stuff.
The solution is to split up efx_ef100_init_datapath_caps into a generic API
that vDPA can use, and this netdev specific API which should not be used by vDPA.

Gautam, you could explain this API split in the description.

Martin

> >
> > > +
> > > int ef100_probe_netdev(struct efx_probe_data *probe_data)
> > > {
> > > struct efx_nic *efx = &probe_data->efx;
> > > @@ -387,9 +409,7 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
> > > ESE_EF100_DP_GZ_TSO_MAX_HDR_NUM_SEGS_DEFAULT);
> > > efx->mdio.dev = net_dev;
> > >
> > > - rc = efx_ef100_init_datapath_caps(efx);
> > > - if (rc < 0)
> > > - goto fail;
> > > + efx_ef100_update_tso_features(efx);
> > >
> > > rc = ef100_phy_probe(efx);
> > > if (rc)
> > > diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> > > index 8cbe5e0f4bdf..ef6e295efcf7 100644
> > > --- a/drivers/net/ethernet/sfc/ef100_nic.c
> > > +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> > > @@ -161,7 +161,7 @@ int ef100_get_mac_address(struct efx_nic *efx, u8 *mac_address,
> > > return 0;
> > > }
> > >
> > > -int efx_ef100_init_datapath_caps(struct efx_nic *efx)
> > > +static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
> > > {
> > > MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_V7_OUT_LEN);
> > > struct ef100_nic_data *nic_data = efx->nic_data;
> > > @@ -197,25 +197,15 @@ int efx_ef100_init_datapath_caps(struct efx_nic *efx)
> > > if (rc)
> > > return rc;
> > >
> > > - if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) {
> > > - struct net_device *net_dev = efx->net_dev;
> > > - netdev_features_t tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
> > > - NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
> > > - NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
> > > -
> > > - net_dev->features |= tso;
> > > - net_dev->hw_features |= tso;
> > > - net_dev->hw_enc_features |= tso;
> > > - /* EF100 HW can only offload outer checksums if they are UDP,
> > > - * so for GRE_CSUM we have to use GSO_PARTIAL.
> > > - */
> > > - net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
> > > - }
> > > efx->num_mac_stats = MCDI_WORD(outbuf,
> > > GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS);
> > > netif_dbg(efx, probe, efx->net_dev,
> > > "firmware reports num_mac_stats = %u\n",
> > > efx->num_mac_stats);
> > > +
> > > + nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
> > > + CLIENT_CMD_VF_PROXY) &&
> > > + efx->type->is_vf;
> > > return 0;
> > > }
> > >
> > > @@ -806,13 +796,6 @@ static char *bar_config_name[] = {
> > > [EF100_BAR_CONFIG_VDPA] = "vDPA",
> > > };
> > >
> > > -#ifdef CONFIG_SFC_VDPA
> > > -static bool efx_vdpa_supported(struct efx_nic *efx)
> > > -{
> > > - return efx->type->is_vf;
> > > -}
> > > -#endif
> > > -
> > > int efx_ef100_set_bar_config(struct efx_nic *efx,
> > > enum ef100_bar_config new_config)
> > > {
> > > @@ -828,7 +811,7 @@ int efx_ef100_set_bar_config(struct efx_nic *efx,
> > >
> > > #ifdef CONFIG_SFC_VDPA
> > > /* Current EF100 hardware supports vDPA on VFs only */
> > > - if (new_config == EF100_BAR_CONFIG_VDPA && !efx_vdpa_supported(efx)) {
> > > + if (new_config == EF100_BAR_CONFIG_VDPA && !nic_data->vdpa_supported) {
> > > pci_err(efx->pci_dev, "vdpa over PF not supported : %s",
> > > efx->name);
> > > return -EOPNOTSUPP;
> > > @@ -1208,6 +1191,12 @@ static int ef100_probe_main(struct efx_nic *efx)
> > > goto fail;
> > > }
> > >
> > > + rc = efx_ef100_init_datapath_caps(efx);
> > > + if (rc) {
> > > + pci_info(efx->pci_dev, "Unable to initialize datapath caps\n");
> > > + goto fail;
> > > + }
> > > +
> > > return 0;
> > > fail:
> > > return rc;
> > > diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h
> > > index 4562982f2965..117a73d0795c 100644
> > > --- a/drivers/net/ethernet/sfc/ef100_nic.h
> > > +++ b/drivers/net/ethernet/sfc/ef100_nic.h
> > > @@ -76,6 +76,9 @@ struct ef100_nic_data {
> > > u32 datapath_caps3;
> > > unsigned int pf_index;
> > > u16 warm_boot_count;
> > > +#ifdef CONFIG_SFC_VDPA
> > > + bool vdpa_supported; /* true if vdpa is supported on this PCIe FN */
> > > +#endif
> > > u8 port_id[ETH_ALEN];
> > > DECLARE_BITMAP(evq_phases, EFX_MAX_CHANNELS);
> > > enum ef100_bar_config bar_config;
> > > @@ -95,9 +98,8 @@ struct ef100_nic_data {
> > > };
> > >
> > > #define efx_ef100_has_cap(caps, flag) \
> > > - (!!((caps) & BIT_ULL(MC_CMD_GET_CAPABILITIES_V4_OUT_ ## flag ## _LBN)))
> > > + (!!((caps) & BIT_ULL(MC_CMD_GET_CAPABILITIES_V7_OUT_ ## flag ## _LBN)))
> > >
> > > -int efx_ef100_init_datapath_caps(struct efx_nic *efx);
> > > int ef100_phy_probe(struct efx_nic *efx);
> > > int ef100_filter_table_probe(struct efx_nic *efx);
> > >
> > > diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
> > > index f6564448d0c7..90062fd8a25d 100644
> > > --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
> > > +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
> > > @@ -1,7 +1,6 @@
> > > /* SPDX-License-Identifier: GPL-2.0 */
> > > -/* Driver for Xilinx network controllers and boards
> > > - * Copyright (C) 2020-2022, Xilinx, Inc.
> > > - * Copyright (C) 2022, Advanced Micro Devices, Inc.
> > > +/* Driver for AMD network controllers and boards
> > > + * Copyright (C) 2023, Advanced Micro Devices, Inc.
> > Let's fix this in the patch that introduces this.
>
> Sure, will fix.
>
> Thanks
>
> >
> > Thanks
> >
> >
> >
> > > *
> > > * This program is free software; you can redistribute it and/or modify it
> > > * under the terms of the GNU General Public License version 2 as published
> > > --
> > > 2.30.1
> > >

2023-03-14 08:48:52

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 11/14] sfc: use PF's IOMMU domain for running VF's MCDI commands

On Mon, Mar 13, 2023 at 10:49:08PM +0530, Gautam Dawar wrote:
>
> On 3/8/23 23:31, Martin Habets wrote:
> > Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> >
> >
> > On Tue, Mar 07, 2023 at 05:06:13PM +0530, Gautam Dawar wrote:
> > > This changeset uses MC_CMD_CLIENT_CMD to execute VF's MCDI
> > > commands when running in vDPA mode (STATE_VDPA).
> > > Also, use the PF's IOMMU domain for executing the encapsulated
> > > VF's MCDI commands to isolate DMA of guest buffers in the VF's
> > > IOMMU domain.
> > > This patch also updates the PCIe FN's client id in the efx_nic
> > > structure which is required while running MC_CMD_CLIENT_CMD.
> > >
> > > Signed-off-by: Gautam Dawar <[email protected]>
> > > ---
> > > drivers/net/ethernet/sfc/ef100.c | 1 +
> > > drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++
> > > drivers/net/ethernet/sfc/mcdi.c | 108 ++++++++++++++++++++++----
> > > drivers/net/ethernet/sfc/mcdi.h | 2 +-
> > > drivers/net/ethernet/sfc/net_driver.h | 2 +
> > > drivers/net/ethernet/sfc/ptp.c | 4 +-
> > > 6 files changed, 132 insertions(+), 20 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
> > > index c1c69783db7b..8453c9ba0f41 100644
> > > --- a/drivers/net/ethernet/sfc/ef100.c
> > > +++ b/drivers/net/ethernet/sfc/ef100.c
> > > @@ -465,6 +465,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
> > > efx->type = (const struct efx_nic_type *)entry->driver_data;
> > >
> > > efx->pci_dev = pci_dev;
> > > + efx->client_id = MC_CMD_CLIENT_ID_SELF;
> > > pci_set_drvdata(pci_dev, efx);
> > > rc = efx_init_struct(efx, pci_dev);
> > > if (rc)
> > > diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> > > index bda4fcbe1126..cd9f724a9e64 100644
> > > --- a/drivers/net/ethernet/sfc/ef100_nic.c
> > > +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> > > @@ -206,9 +206,11 @@ static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
> > > "firmware reports num_mac_stats = %u\n",
> > > efx->num_mac_stats);
> > >
> > > +#ifdef CONFIG_SFC_VDPA
> > More opportunities to use IS_ENABLED(CONFIG_SFC_VDPA) in this patch
> > in stead of the #ifdef.
>
> Will fix the occurrence where nic_data->vdpa_supported is being updated.
> However, I am not sure if using something like:
>
> if (IS_ENABLED(CONFIG_SFC_VDPA) && (new_config == EF100_BAR_CONFIG_VDPA &&
> !nic_data->vdpa_supported))
>
> to replace
>
> #ifdef CONFIG_SFC_VDPA
> ??????? if (new_config == EF100_BAR_CONFIG_VDPA &&
> !nic_data->vdpa_supported) {
>
> would be correct as vdpa_supported itself is conditionally defined:
>
> struct ef100_nic_data {
>
> ...
>
> #ifdef CONFIG_SFC_VDPA
> ??????? bool vdpa_supported; /* true if vdpa is supported on this PCIe FN */
> ?...
>
> }

I think you're right. Since vdpa_supported is inside an #ifdef you have to
keep the code that uses it also inside an #ifdef.

Martin

> Another way would be to use nested if statements but not sure if it is
> really needed.
>
> Thanks
>
> >
> > Martin
> >
> > > nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
> > > CLIENT_CMD_VF_PROXY) &&
> > > efx->type->is_vf;
> > > +#endif
> > > return 0;
> > > }
> > >
> > > @@ -1086,6 +1088,35 @@ static int ef100_check_design_params(struct efx_nic *efx)
> > > return rc;
> > > }
> > >
> > > +static int efx_ef100_update_client_id(struct efx_nic *efx)
> > > +{
> > > + struct ef100_nic_data *nic_data = efx->nic_data;
> > > + unsigned int pf_index = PCIE_FUNCTION_PF_NULL;
> > > + unsigned int vf_index = PCIE_FUNCTION_VF_NULL;
> > > + efx_qword_t pciefn;
> > > + int rc;
> > > +
> > > + if (efx->pci_dev->is_virtfn)
> > > + vf_index = nic_data->vf_index;
> > > + else
> > > + pf_index = nic_data->pf_index;
> > > +
> > > + /* Construct PCIE_FUNCTION structure */
> > > + EFX_POPULATE_QWORD_3(pciefn,
> > > + PCIE_FUNCTION_PF, pf_index,
> > > + PCIE_FUNCTION_VF, vf_index,
> > > + PCIE_FUNCTION_INTF, PCIE_INTERFACE_CALLER);
> > > + /* look up self client ID */
> > > + rc = efx_ef100_lookup_client_id(efx, pciefn, &efx->client_id);
> > > + if (rc) {
> > > + pci_warn(efx->pci_dev,
> > > + "%s: Failed to get client ID, rc %d\n",
> > > + __func__, rc);
> > > + }
> > > +
> > > + return rc;
> > > +}
> > > +
> > > /* NIC probe and remove
> > > */
> > > static int ef100_probe_main(struct efx_nic *efx)
> > > @@ -1173,6 +1204,10 @@ static int ef100_probe_main(struct efx_nic *efx)
> > > goto fail;
> > > efx->port_num = rc;
> > >
> > > + rc = efx_ef100_update_client_id(efx);
> > > + if (rc)
> > > + goto fail;
> > > +
> > > efx_mcdi_print_fwver(efx, fw_version, sizeof(fw_version));
> > > pci_dbg(efx->pci_dev, "Firmware version %s\n", fw_version);
> > >
> > > diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
> > > index a7f2c31071e8..3bf1ebe05775 100644
> > > --- a/drivers/net/ethernet/sfc/mcdi.c
> > > +++ b/drivers/net/ethernet/sfc/mcdi.c
> > > @@ -145,14 +145,15 @@ void efx_mcdi_fini(struct efx_nic *efx)
> > > kfree(efx->mcdi);
> > > }
> > >
> > > -static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
> > > - const efx_dword_t *inbuf, size_t inlen)
> > > +static void efx_mcdi_send_request(struct efx_nic *efx, u32 client_id,
> > > + unsigned int cmd, const efx_dword_t *inbuf,
> > > + size_t inlen)
> > > {
> > > struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
> > > #ifdef CONFIG_SFC_MCDI_LOGGING
> > > char *buf = mcdi->logging_buffer; /* page-sized */
> > > #endif
> > > - efx_dword_t hdr[2];
> > > + efx_dword_t hdr[5];
> > > size_t hdr_len;
> > > u32 xflags, seqno;
> > >
> > > @@ -179,7 +180,7 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
> > > MCDI_HEADER_XFLAGS, xflags,
> > > MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
> > > hdr_len = 4;
> > > - } else {
> > > + } else if (client_id == efx->client_id) {
> > > /* MCDI v2 */
> > > BUG_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
> > > EFX_POPULATE_DWORD_7(hdr[0],
> > > @@ -194,6 +195,35 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
> > > MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
> > > MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
> > > hdr_len = 8;
> > > + } else {
> > > + /* MCDI v2 */
> > > + WARN_ON(inlen > MCDI_CTL_SDU_LEN_MAX_V2);
> > > + /* MCDI v2 with credentials of a different client */
> > > + BUILD_BUG_ON(MC_CMD_CLIENT_CMD_IN_LEN != 4);
> > > + /* Outer CLIENT_CMD wrapper command with client ID */
> > > + EFX_POPULATE_DWORD_7(hdr[0],
> > > + MCDI_HEADER_RESPONSE, 0,
> > > + MCDI_HEADER_RESYNC, 1,
> > > + MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
> > > + MCDI_HEADER_DATALEN, 0,
> > > + MCDI_HEADER_SEQ, seqno,
> > > + MCDI_HEADER_XFLAGS, xflags,
> > > + MCDI_HEADER_NOT_EPOCH, !mcdi->new_epoch);
> > > + EFX_POPULATE_DWORD_2(hdr[1],
> > > + MC_CMD_V2_EXTN_IN_EXTENDED_CMD,
> > > + MC_CMD_CLIENT_CMD,
> > > + MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen + 12);
> > > + MCDI_SET_DWORD(&hdr[2],
> > > + CLIENT_CMD_IN_CLIENT_ID, client_id);
> > > +
> > > + /* MCDIv2 header for inner command */
> > > + EFX_POPULATE_DWORD_2(hdr[3],
> > > + MCDI_HEADER_CODE, MC_CMD_V2_EXTN,
> > > + MCDI_HEADER_DATALEN, 0);
> > > + EFX_POPULATE_DWORD_2(hdr[4],
> > > + MC_CMD_V2_EXTN_IN_EXTENDED_CMD, cmd,
> > > + MC_CMD_V2_EXTN_IN_ACTUAL_LEN, inlen);
> > > + hdr_len = 20;
> > > }
> > >
> > > #ifdef CONFIG_SFC_MCDI_LOGGING
> > > @@ -474,7 +504,8 @@ static void efx_mcdi_release(struct efx_mcdi_iface *mcdi)
> > > &mcdi->async_list, struct efx_mcdi_async_param, list);
> > > if (async) {
> > > mcdi->state = MCDI_STATE_RUNNING_ASYNC;
> > > - efx_mcdi_send_request(efx, async->cmd,
> > > + efx_mcdi_send_request(efx, efx->client_id,
> > > + async->cmd,
> > > (const efx_dword_t *)(async + 1),
> > > async->inlen);
> > > mod_timer(&mcdi->async_timer,
> > > @@ -797,7 +828,7 @@ static int efx_mcdi_proxy_wait(struct efx_nic *efx, u32 handle, bool quiet)
> > > return mcdi->proxy_rx_status;
> > > }
> > >
> > > -static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
> > > +static int _efx_mcdi_rpc(struct efx_nic *efx, u32 client_id, unsigned int cmd,
> > > const efx_dword_t *inbuf, size_t inlen,
> > > efx_dword_t *outbuf, size_t outlen,
> > > size_t *outlen_actual, bool quiet, int *raw_rc)
> > > @@ -811,7 +842,7 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
> > > return -EINVAL;
> > > }
> > >
> > > - rc = efx_mcdi_rpc_start(efx, cmd, inbuf, inlen);
> > > + rc = efx_mcdi_rpc_start(efx, client_id, cmd, inbuf, inlen);
> > > if (rc)
> > > return rc;
> > >
> > > @@ -836,7 +867,8 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
> > >
> > > /* We now retry the original request. */
> > > mcdi->state = MCDI_STATE_RUNNING_SYNC;
> > > - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
> > > + efx_mcdi_send_request(efx, efx->client_id, cmd,
> > > + inbuf, inlen);
> > >
> > > rc = _efx_mcdi_rpc_finish(efx, cmd, inlen,
> > > outbuf, outlen, outlen_actual,
> > > @@ -855,16 +887,44 @@ static int _efx_mcdi_rpc(struct efx_nic *efx, unsigned int cmd,
> > > return rc;
> > > }
> > >
> > > +#ifdef CONFIG_SFC_VDPA
> > > +static bool is_mode_vdpa(struct efx_nic *efx)
> > > +{
> > > + if (efx->pci_dev->is_virtfn &&
> > > + efx->pci_dev->physfn &&
> > > + efx->state == STATE_VDPA &&
> > > + efx->vdpa_nic)
> > > + return true;
> > > +
> > > + return false;
> > > +}
> > > +#endif
> > > +
> > > static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
> > > const efx_dword_t *inbuf, size_t inlen,
> > > efx_dword_t *outbuf, size_t outlen,
> > > size_t *outlen_actual, bool quiet)
> > > {
> > > +#ifdef CONFIG_SFC_VDPA
> > > + struct efx_nic *efx_pf;
> > > +#endif
> > > int raw_rc = 0;
> > > int rc;
> > >
> > > - rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
> > > - outbuf, outlen, outlen_actual, true, &raw_rc);
> > > +#ifdef CONFIG_SFC_VDPA
> > > + if (is_mode_vdpa(efx)) {
> > > + efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
> > > + rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd, inbuf,
> > > + inlen, outbuf, outlen, outlen_actual,
> > > + true, &raw_rc);
> > > + } else {
> > > +#endif
> > > + rc = _efx_mcdi_rpc(efx, efx->client_id, cmd, inbuf,
> > > + inlen, outbuf, outlen, outlen_actual, true,
> > > + &raw_rc);
> > > +#ifdef CONFIG_SFC_VDPA
> > > + }
> > > +#endif
> > >
> > > if ((rc == -EPROTO) && (raw_rc == MC_CMD_ERR_NO_EVB_PORT) &&
> > > efx->type->is_vf) {
> > > @@ -881,9 +941,22 @@ static int _efx_mcdi_rpc_evb_retry(struct efx_nic *efx, unsigned cmd,
> > >
> > > do {
> > > usleep_range(delay_us, delay_us + 10000);
> > > - rc = _efx_mcdi_rpc(efx, cmd, inbuf, inlen,
> > > - outbuf, outlen, outlen_actual,
> > > - true, &raw_rc);
> > > +#ifdef CONFIG_SFC_VDPA
> > > + if (is_mode_vdpa(efx)) {
> > > + efx_pf = pci_get_drvdata(efx->pci_dev->physfn);
> > > + rc = _efx_mcdi_rpc(efx_pf, efx->client_id, cmd,
> > > + inbuf, inlen, outbuf, outlen,
> > > + outlen_actual, true,
> > > + &raw_rc);
> > > + } else {
> > > +#endif
> > > + rc = _efx_mcdi_rpc(efx, efx->client_id,
> > > + cmd, inbuf, inlen, outbuf,
> > > + outlen, outlen_actual, true,
> > > + &raw_rc);
> > > +#ifdef CONFIG_SFC_VDPA
> > > + }
> > > +#endif
> > > if (delay_us < 100000)
> > > delay_us <<= 1;
> > > } while ((rc == -EPROTO) &&
> > > @@ -939,7 +1012,7 @@ int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd,
> > > * function and is then responsible for calling efx_mcdi_display_error
> > > * as needed.
> > > */
> > > -int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
> > > +int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned int cmd,
> > > const efx_dword_t *inbuf, size_t inlen,
> > > efx_dword_t *outbuf, size_t outlen,
> > > size_t *outlen_actual)
> > > @@ -948,7 +1021,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
> > > outlen_actual, true);
> > > }
> > >
> > > -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
> > > +int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
> > > const efx_dword_t *inbuf, size_t inlen)
> > > {
> > > struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
> > > @@ -965,7 +1038,7 @@ int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
> > > return -ENETDOWN;
> > >
> > > efx_mcdi_acquire_sync(mcdi);
> > > - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
> > > + efx_mcdi_send_request(efx, client_id, cmd, inbuf, inlen);
> > > return 0;
> > > }
> > >
> > > @@ -1009,7 +1082,8 @@ static int _efx_mcdi_rpc_async(struct efx_nic *efx, unsigned int cmd,
> > > */
> > > if (mcdi->async_list.next == &async->list &&
> > > efx_mcdi_acquire_async(mcdi)) {
> > > - efx_mcdi_send_request(efx, cmd, inbuf, inlen);
> > > + efx_mcdi_send_request(efx, efx->client_id,
> > > + cmd, inbuf, inlen);
> > > mod_timer(&mcdi->async_timer,
> > > jiffies + MCDI_RPC_TIMEOUT);
> > > }
> > > diff --git a/drivers/net/ethernet/sfc/mcdi.h b/drivers/net/ethernet/sfc/mcdi.h
> > > index dafab52aaef7..2c526d2edeb6 100644
> > > --- a/drivers/net/ethernet/sfc/mcdi.h
> > > +++ b/drivers/net/ethernet/sfc/mcdi.h
> > > @@ -150,7 +150,7 @@ int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
> > > efx_dword_t *outbuf, size_t outlen,
> > > size_t *outlen_actual);
> > >
> > > -int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
> > > +int efx_mcdi_rpc_start(struct efx_nic *efx, u32 client_id, unsigned int cmd,
> > > const efx_dword_t *inbuf, size_t inlen);
> > > int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
> > > efx_dword_t *outbuf, size_t outlen,
> > > diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
> > > index 1da71deac71c..948c7a06403a 100644
> > > --- a/drivers/net/ethernet/sfc/net_driver.h
> > > +++ b/drivers/net/ethernet/sfc/net_driver.h
> > > @@ -859,6 +859,7 @@ struct efx_mae;
> > > * @secondary_list: List of &struct efx_nic instances for the secondary PCI
> > > * functions of the controller, if this is for the primary function.
> > > * Serialised by rtnl_lock.
> > > + * @client_id: client ID of this PCIe function
> > > * @type: Controller type attributes
> > > * @legacy_irq: IRQ number
> > > * @workqueue: Workqueue for port reconfigures and the HW monitor.
> > > @@ -1022,6 +1023,7 @@ struct efx_nic {
> > > struct list_head secondary_list;
> > > struct pci_dev *pci_dev;
> > > unsigned int port_num;
> > > + u32 client_id;
> > > const struct efx_nic_type *type;
> > > int legacy_irq;
> > > bool eeh_disabled_legacy_irq;
> > > diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
> > > index 9f07e1ba7780..d90d4f6b3824 100644
> > > --- a/drivers/net/ethernet/sfc/ptp.c
> > > +++ b/drivers/net/ethernet/sfc/ptp.c
> > > @@ -1052,8 +1052,8 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
> > >
> > > /* Clear flag that signals MC ready */
> > > WRITE_ONCE(*start, 0);
> > > - rc = efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf,
> > > - MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
> > > + rc = efx_mcdi_rpc_start(efx, MC_CMD_CLIENT_ID_SELF, MC_CMD_PTP,
> > > + synch_buf, MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
> > > EFX_WARN_ON_ONCE_PARANOID(rc);
> > >
> > > /* Wait for start from MCDI (or timeout) */
> > > --
> > > 2.30.1

2023-03-15 04:53:14

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 13/14] sfc: update vdpa device MAC address


在 2023/3/13 14:37, Gautam Dawar 写道:
> On 3/10/23 10:35, Jason Wang wrote:
>> Caution: This message originated from an External Source. Use proper
>> caution when opening attachments, clicking links, or responding.
>>
>>
>> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]>
>> wrote:
>>> As the VF MAC address can now be updated using `devlink port
>>> function set`
>> What happens if we run this while the vpda is being used by a VM?
> IIUC, updating the MAC address using devlink interface requires
> unbinding the device from driver and hence updating the MAC while vdpa
> device is in-use won't be possible. It can only be done via control vq
> VIRTIO_NET_CTRL_MAC_ADDR_SET command, when available.


Good to know that.


>>
>>> interface, fetch the vdpa device MAC address from the underlying VF
>>> during
>>> vdpa device creation.
>>>
>>> Signed-off-by: Gautam Dawar <[email protected]>
>>> ---
>>>   drivers/net/ethernet/sfc/ef100_vdpa.c | 12 ++++++++++++
>>>   1 file changed, 12 insertions(+)
>>>
>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> index 30ca4ab00175..32182a01f6a5 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> @@ -272,6 +272,18 @@ static int get_net_config(struct ef100_vdpa_nic
>>> *vdpa_nic)
>>>          vdpa_nic->net_config.max_virtqueue_pairs =
>>>                  cpu_to_efx_vdpa16(vdpa_nic,
>>> vdpa_nic->max_queue_pairs);
>>>
>>> +       rc = ef100_get_mac_address(efx, vdpa_nic->mac_address,
>>> +                                  efx->client_id, true);
>>> +       if (rc) {
>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>> +                       "%s: Get MAC for vf:%u failed:%d\n", __func__,
>>> +                       vdpa_nic->vf_index, rc);
>>> +               return rc;
>>> +       }
>> Can this override what is provisioned by the userspace?
>
> No, this was carefully avoided by overwriting the userspace
> provisioned MAC in ef100_vdpa_create():
>
>         rc = get_net_config(vdpa_nic);
>         if (rc)
>                 goto err_put_device;
>
>         if (mac) {
>                 ether_addr_copy(vdpa_nic->mac_address, mac);
>                 vdpa_nic->mac_configured = true;
>         }


Ah, I see.

Thanks


>
>>
>> Thanks
>>
>>
>>> +
>>> +       if (is_valid_ether_addr(vdpa_nic->mac_address))
>>> +               vdpa_nic->mac_configured = true;
>>> +
>>>          rc = efx_vdpa_get_mtu(efx, &mtu);
>>>          if (rc) {
>>>                  dev_err(&vdpa_nic->vdpa_dev.dev,
>>> --
>>> 2.30.1
>>>
>


2023-03-15 04:55:09

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 12/14] sfc: unmap VF's MCDI buffer when switching to vDPA mode


在 2023/3/13 15:09, Gautam Dawar 写道:
>
> On 3/10/23 10:35, Jason Wang wrote:
>> Caution: This message originated from an External Source. Use proper
>> caution when opening attachments, clicking links, or responding.
>>
>>
>> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]>
>> wrote:
>>> To avoid clash of IOVA range of VF's MCDI DMA buffer with the guest
>>> buffer IOVAs, unmap the MCDI buffer when switching to vDPA mode
>>> and use PF's IOMMU domain for running VF's MCDI commands.
>>>
>>> Signed-off-by: Gautam Dawar <[email protected]>
>>> ---
>>>   drivers/net/ethernet/sfc/ef100_nic.c      |  1 -
>>>   drivers/net/ethernet/sfc/ef100_vdpa.c     | 25 ++++++++++++++++
>>>   drivers/net/ethernet/sfc/ef100_vdpa.h     |  3 ++
>>>   drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 35
>>> +++++++++++++++++++++++
>>>   drivers/net/ethernet/sfc/mcdi.h           |  3 ++
>>>   drivers/net/ethernet/sfc/net_driver.h     | 12 ++++++++
>>>   6 files changed, 78 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c
>>> b/drivers/net/ethernet/sfc/ef100_nic.c
>>> index cd9f724a9e64..1bffc1994ed8 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_nic.c
>>> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
>>> @@ -33,7 +33,6 @@
>>>
>>>   #define EF100_MAX_VIS 4096
>>>   #define EF100_NUM_MCDI_BUFFERS 1
>>> -#define MCDI_BUF_LEN (8 + MCDI_CTL_SDU_LEN_MAX)
>>>
>>>   #define EF100_RESET_PORT ((ETH_RESET_MAC | ETH_RESET_PHY) <<
>>> ETH_RESET_SHARED_SHIFT)
>>>
>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> index 5c9f29f881a6..30ca4ab00175 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> @@ -223,10 +223,19 @@ static int vdpa_allocate_vis(struct efx_nic
>>> *efx, unsigned int *allocated_vis)
>>>   static void ef100_vdpa_delete(struct efx_nic *efx)
>>>   {
>>>          struct vdpa_device *vdpa_dev;
>>> +       int rc;
>>>
>>>          if (efx->vdpa_nic) {
>>>                  vdpa_dev = &efx->vdpa_nic->vdpa_dev;
>>>                  ef100_vdpa_reset(vdpa_dev);
>>> +               if (efx->mcdi_buf_mode == EFX_BUF_MODE_VDPA) {
>>> +                       rc = ef100_vdpa_map_mcdi_buffer(efx);
>>> +                       if (rc) {
>>> +                               pci_err(efx->pci_dev,
>>> +                                       "map_mcdi_buffer failed,
>>> err: %d\n",
>>> +                                       rc);
>>> +                       }
>>> +               }
>>>
>>>                  /* replace with _vdpa_unregister_device later */
>>>                  put_device(&vdpa_dev->dev);
>>> @@ -276,6 +285,21 @@ static int get_net_config(struct ef100_vdpa_nic
>>> *vdpa_nic)
>>>          return 0;
>>>   }
>>>
>>> +static void unmap_mcdi_buffer(struct efx_nic *efx)
>>> +{
>>> +       struct ef100_nic_data *nic_data = efx->nic_data;
>>> +       struct efx_mcdi_iface *mcdi;
>>> +
>>> +       mcdi = efx_mcdi(efx);
>>> +       spin_lock_bh(&mcdi->iface_lock);
>>> +       /* Save current MCDI mode to be restored later */
>>> +       efx->vdpa_nic->mcdi_mode = mcdi->mode;
>>> +       efx->mcdi_buf_mode = EFX_BUF_MODE_VDPA;
>>> +       mcdi->mode = MCDI_MODE_FAIL;
>>> +       spin_unlock_bh(&mcdi->iface_lock);
>>> +       efx_nic_free_buffer(efx, &nic_data->mcdi_buf);
>>> +}
>>> +
>>>   static struct ef100_vdpa_nic *ef100_vdpa_create(struct efx_nic *efx,
>>>                                                  const char *dev_name,
>>>                                                  enum
>>> ef100_vdpa_class dev_type,
>>> @@ -342,6 +366,7 @@ static struct ef100_vdpa_nic
>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>          for (i = 0; i < EF100_VDPA_MAC_FILTER_NTYPES; i++)
>>>                  vdpa_nic->filters[i].filter_id =
>>> EFX_INVALID_FILTER_ID;
>>>
>>> +       unmap_mcdi_buffer(efx);
>>>          rc = get_net_config(vdpa_nic);
>>>          if (rc)
>>>                  goto err_put_device;
>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> index 49fb6be04eb3..0913ac2519cb 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> @@ -147,6 +147,7 @@ struct ef100_vdpa_filter {
>>>    * @status: device status as per VIRTIO spec
>>>    * @features: negotiated feature bits
>>>    * @max_queue_pairs: maximum number of queue pairs supported
>>> + * @mcdi_mode: MCDI mode at the time of unmapping VF mcdi buffer
>>>    * @net_config: virtio_net_config data
>>>    * @vring: vring information of the vDPA device.
>>>    * @mac_address: mac address of interface associated with this
>>> vdpa device
>>> @@ -166,6 +167,7 @@ struct ef100_vdpa_nic {
>>>          u8 status;
>>>          u64 features;
>>>          u32 max_queue_pairs;
>>> +       enum efx_mcdi_mode mcdi_mode;
>>>          struct virtio_net_config net_config;
>>>          struct ef100_vdpa_vring_info
>>> vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
>>>          u8 *mac_address;
>>> @@ -185,6 +187,7 @@ int ef100_vdpa_add_filter(struct ef100_vdpa_nic
>>> *vdpa_nic,
>>>   int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>>>   void ef100_vdpa_irq_vectors_free(void *data);
>>>   int ef100_vdpa_reset(struct vdpa_device *vdev);
>>> +int ef100_vdpa_map_mcdi_buffer(struct efx_nic *efx);
>>>
>>>   static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic
>>> *vdpa_nic)
>>>   {
>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> index db86c2693950..c6c9458f0e6f 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> @@ -711,12 +711,47 @@ static int ef100_vdpa_suspend(struct
>>> vdpa_device *vdev)
>>>          mutex_unlock(&vdpa_nic->lock);
>>>          return rc;
>>>   }
>>> +
>>> +int ef100_vdpa_map_mcdi_buffer(struct efx_nic *efx)
>>> +{
>> The name of this function is confusing, it's actually map buffer for
>> ef100 netdev mode.
>
> Yeah, I get your point. Actually, I am using the prefix ef100_vdpa_
> for extern functions and this function is just mapping the  MCDI
> buffer resulting in the name ef100_vdpa_map_mcdi_buffer().
>
> I think ef100_vdpa_map_vf_mcdi_buffer() would remove this confusion.
> What do you think?


Not a native speaker, but for me, it would be better to remove "vdpa"
from the name since the buffer is not used by vDPA (if I understand the
code correctly).


>
>>
>> Actually, I wonder why not moving this to init/fini of bar config ops
>> or if we use aux bus, it should be done during aux driver
>> probe/remove.
> It makes sense, however we store the last mcdi mode (poll or events)
> in vdpa_nic->mcdi_mode to restore later, which requires vdpa_nic to be
> allocated that happens later than switching to vdpa bar_config.


Ok.

Thanks


>> Thanks
>>
>>
>>> +       struct ef100_nic_data *nic_data = efx->nic_data;
>>> +       struct efx_mcdi_iface *mcdi;
>>> +       int rc;
>>> +
>>> +       /* Update VF's MCDI buffer when switching out of vdpa mode */
>>> +       rc = efx_nic_alloc_buffer(efx, &nic_data->mcdi_buf,
>>> +                                 MCDI_BUF_LEN, GFP_KERNEL);
>>> +       if (rc)
>>> +               return rc;
>>> +
>>> +       mcdi = efx_mcdi(efx);
>>> +       spin_lock_bh(&mcdi->iface_lock);
>>> +       mcdi->mode = efx->vdpa_nic->mcdi_mode;
>>> +       efx->mcdi_buf_mode = EFX_BUF_MODE_EF100;
>>> +       spin_unlock_bh(&mcdi->iface_lock);
>>> +
>>> +       return 0;
>>> +}
>>> +
>>>   static void ef100_vdpa_free(struct vdpa_device *vdev)
>>>   {
>>>          struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       int rc;
>>>          int i;
>>>
>>>          if (vdpa_nic) {
>>> +               if (vdpa_nic->efx->mcdi_buf_mode ==
>>> EFX_BUF_MODE_VDPA) {
>>> +                       /* This will only be called via call to
>>> put_device()
>>> +                        * on vdpa device creation failure
>>> +                        */
>>> +                       rc = ef100_vdpa_map_mcdi_buffer(vdpa_nic->efx);
>>> +                       if (rc) {
>>> +                               dev_err(&vdev->dev,
>>> +                                       "map_mcdi_buffer failed,
>>> err: %d\n",
>>> +                                       rc);
>>> +                       }
>>> +               }
>>> +
>>>                  for (i = 0; i < (vdpa_nic->max_queue_pairs * 2);
>>> i++) {
>>>                          reset_vring(vdpa_nic, i);
>>>                          if (vdpa_nic->vring[i].vring_ctx)
>>> diff --git a/drivers/net/ethernet/sfc/mcdi.h
>>> b/drivers/net/ethernet/sfc/mcdi.h
>>> index 2c526d2edeb6..bc4de3b4e6f3 100644
>>> --- a/drivers/net/ethernet/sfc/mcdi.h
>>> +++ b/drivers/net/ethernet/sfc/mcdi.h
>>> @@ -6,6 +6,9 @@
>>>
>>>   #ifndef EFX_MCDI_H
>>>   #define EFX_MCDI_H
>>> +#include "mcdi_pcol.h"
>>> +
>>> +#define MCDI_BUF_LEN (8 + MCDI_CTL_SDU_LEN_MAX)
>>>
>>>   /**
>>>    * enum efx_mcdi_state - MCDI request handling state
>>> diff --git a/drivers/net/ethernet/sfc/net_driver.h
>>> b/drivers/net/ethernet/sfc/net_driver.h
>>> index 948c7a06403a..9cdfeb6ad05a 100644
>>> --- a/drivers/net/ethernet/sfc/net_driver.h
>>> +++ b/drivers/net/ethernet/sfc/net_driver.h
>>> @@ -848,6 +848,16 @@ enum efx_xdp_tx_queues_mode {
>>>
>>>   struct efx_mae;
>>>
>>> +/**
>>> + * enum efx_buf_alloc_mode - buffer allocation mode
>>> + * @EFX_BUF_MODE_EF100: buffer setup in ef100 mode
>>> + * @EFX_BUF_MODE_VDPA: buffer setup in vdpa mode
>>> + */
>>> +enum efx_buf_alloc_mode {
>>> +       EFX_BUF_MODE_EF100,
>>> +       EFX_BUF_MODE_VDPA
>>> +};
>>> +
>>>   /**
>>>    * struct efx_nic - an Efx NIC
>>>    * @name: Device name (net device name or bus id before net device
>>> registered)
>>> @@ -877,6 +887,7 @@ struct efx_mae;
>>>    * @irq_rx_mod_step_us: Step size for IRQ moderation for RX event
>>> queues
>>>    * @irq_rx_moderation_us: IRQ moderation time for RX event queues
>>>    * @msg_enable: Log message enable flags
>>> + * @mcdi_buf_mode: mcdi buffer allocation mode
>>>    * @state: Device state number (%STATE_*). Serialised by the
>>> rtnl_lock.
>>>    * @reset_pending: Bitmask for pending resets
>>>    * @tx_queue: TX DMA queues
>>> @@ -1045,6 +1056,7 @@ struct efx_nic {
>>>          u32 msg_enable;
>>>
>>>          enum nic_state state;
>>> +       enum efx_buf_alloc_mode mcdi_buf_mode;
>>>          unsigned long reset_pending;
>>>
>>>          struct efx_channel *channel[EFX_MAX_CHANNELS];
>>> --
>>> 2.30.1
>>>
>


2023-03-15 05:01:39

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 09/14] sfc: implement device status related vdpa config operations


在 2023/3/13 20:10, Gautam Dawar 写道:
>
> On 3/10/23 10:35, Jason Wang wrote:
>> Caution: This message originated from an External Source. Use proper
>> caution when opening attachments, clicking links, or responding.
>>
>>
>> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]>
>> wrote:
>>> vDPA config opertions to handle get/set device status and device
>>> reset have been implemented. Also .suspend config operation is
>>> implemented to support Live Migration.
>>>
>>> Signed-off-by: Gautam Dawar <[email protected]>
>>> ---
>>>   drivers/net/ethernet/sfc/ef100_vdpa.c     |  16 +-
>>>   drivers/net/ethernet/sfc/ef100_vdpa.h     |   2 +
>>>   drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 367
>>> ++++++++++++++++++++--
>>>   3 files changed, 355 insertions(+), 30 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> index c66e5aef69ea..4ba57827a6cd 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> @@ -68,9 +68,14 @@ static int vdpa_allocate_vis(struct efx_nic *efx,
>>> unsigned int *allocated_vis)
>>>
>>>   static void ef100_vdpa_delete(struct efx_nic *efx)
>>>   {
>>> +       struct vdpa_device *vdpa_dev;
>>> +
>>>          if (efx->vdpa_nic) {
>>> +               vdpa_dev = &efx->vdpa_nic->vdpa_dev;
>>> +               ef100_vdpa_reset(vdpa_dev);
>>> +
>>>                  /* replace with _vdpa_unregister_device later */
>>> - put_device(&efx->vdpa_nic->vdpa_dev.dev);
>>> +               put_device(&vdpa_dev->dev);
>>>          }
>>>          efx_mcdi_free_vis(efx);
>>>   }
>>> @@ -171,6 +176,15 @@ static struct ef100_vdpa_nic
>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>                  }
>>>          }
>>>
>>> +       rc = devm_add_action_or_reset(&efx->pci_dev->dev,
>>> + ef100_vdpa_irq_vectors_free,
>>> +                                     efx->pci_dev);
>>> +       if (rc) {
>>> +               pci_err(efx->pci_dev,
>>> +                       "Failed adding devres for freeing irq
>>> vectors\n");
>>> +               goto err_put_device;
>>> +       }
>>> +
>>>          rc = get_net_config(vdpa_nic);
>>>          if (rc)
>>>                  goto err_put_device;
>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> index 348ca8a7404b..58791402e454 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> @@ -149,6 +149,8 @@ int ef100_vdpa_register_mgmtdev(struct efx_nic
>>> *efx);
>>>   void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
>>>   void ef100_vdpa_irq_vectors_free(void *data);
>>>   int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>>> +void ef100_vdpa_irq_vectors_free(void *data);
>>> +int ef100_vdpa_reset(struct vdpa_device *vdev);
>>>
>>>   static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic
>>> *vdpa_nic)
>>>   {
>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> index 0051c4c0e47c..95a2177f85a2 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> @@ -22,11 +22,6 @@ static struct ef100_vdpa_nic *get_vdpa_nic(struct
>>> vdpa_device *vdev)
>>>          return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
>>>   }
>>>
>>> -void ef100_vdpa_irq_vectors_free(void *data)
>>> -{
>>> -       pci_free_irq_vectors(data);
>>> -}
>>> -
>>>   static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>   {
>>>          struct efx_vring_ctx *vring_ctx;
>>> @@ -52,14 +47,6 @@ static void delete_vring_ctx(struct
>>> ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>          vdpa_nic->vring[idx].vring_ctx = NULL;
>>>   }
>>>
>>> -static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> -{
>>> -       vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>>> -       vdpa_nic->vring[idx].vring_state = 0;
>>> -       vdpa_nic->vring[idx].last_avail_idx = 0;
>>> -       vdpa_nic->vring[idx].last_used_idx = 0;
>>> -}
>>> -
>>>   int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>   {
>>>          u32 offset;
>>> @@ -103,6 +90,236 @@ static bool is_qid_invalid(struct
>>> ef100_vdpa_nic *vdpa_nic, u16 idx,
>>>          return false;
>>>   }
>>>
>>> +static void irq_vring_fini(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> +{
>>> +       struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
>>> +       struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
>>> +
>>> +       devm_free_irq(&pci_dev->dev, vring->irq, vring);
>>> +       vring->irq = -EINVAL;
>>> +}
>>> +
>>> +static irqreturn_t vring_intr_handler(int irq, void *arg)
>>> +{
>>> +       struct ef100_vdpa_vring_info *vring = arg;
>>> +
>>> +       if (vring->cb.callback)
>>> +               return vring->cb.callback(vring->cb.private);
>>> +
>>> +       return IRQ_NONE;
>>> +}
>>> +
>>> +static int ef100_vdpa_irq_vectors_alloc(struct pci_dev *pci_dev,
>>> u16 nvqs)
>>> +{
>>> +       int rc;
>>> +
>>> +       rc = pci_alloc_irq_vectors(pci_dev, nvqs, nvqs, PCI_IRQ_MSIX);
>>> +       if (rc < 0)
>>> +               pci_err(pci_dev,
>>> +                       "Failed to alloc %d IRQ vectors, err:%d\n",
>>> nvqs, rc);
>>> +       return rc;
>>> +}
>>> +
>>> +void ef100_vdpa_irq_vectors_free(void *data)
>>> +{
>>> +       pci_free_irq_vectors(data);
>>> +}
>>> +
>>> +static int irq_vring_init(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> +{
>>> +       struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
>>> +       struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
>>> +       int irq;
>>> +       int rc;
>>> +
>>> +       snprintf(vring->msix_name, 256, "x_vdpa[%s]-%d\n",
>>> +                pci_name(pci_dev), idx);
>>> +       irq = pci_irq_vector(pci_dev, idx);
>>> +       rc = devm_request_irq(&pci_dev->dev, irq,
>>> vring_intr_handler, 0,
>>> +                             vring->msix_name, vring);
>>> +       if (rc)
>>> +               pci_err(pci_dev,
>>> +                       "devm_request_irq failed for vring %d, rc
>>> %d\n",
>>> +                       idx, rc);
>>> +       else
>>> +               vring->irq = irq;
>>> +
>>> +       return rc;
>>> +}
>>> +
>>> +static int delete_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> +{
>>> +       struct efx_vring_dyn_cfg vring_dyn_cfg;
>>> +       int rc;
>>> +
>>> +       if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>>> +               return 0;
>>> +
>>> +       rc = efx_vdpa_vring_destroy(vdpa_nic->vring[idx].vring_ctx,
>>> +                                   &vring_dyn_cfg);
>>> +       if (rc)
>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>> +                       "%s: delete vring failed index:%u, err:%d\n",
>>> +                       __func__, idx, rc);
>>> +       vdpa_nic->vring[idx].last_avail_idx = vring_dyn_cfg.avail_idx;
>>> +       vdpa_nic->vring[idx].last_used_idx = vring_dyn_cfg.used_idx;
>>> +       vdpa_nic->vring[idx].vring_state &= ~EF100_VRING_CREATED;
>>> +
>>> +       irq_vring_fini(vdpa_nic, idx);
>>> +
>>> +       return rc;
>>> +}
>>> +
>>> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       u32 idx_val;
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               return;
>>> +
>>> +       if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>>> +               return;
>>> +
>>> +       idx_val = idx;
>>> +       _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>>> +                   vdpa_nic->vring[idx].doorbell_offset);
>>> +}
>>> +
>>> +static bool can_create_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> +{
>>> +       if (vdpa_nic->vring[idx].vring_state ==
>>> EF100_VRING_CONFIGURED &&
>>> +           vdpa_nic->status & VIRTIO_CONFIG_S_DRIVER_OK &&
>>> +           !(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>>> +               return true;
>>> +
>>> +       return false;
>>> +}
>>> +
>>> +static int create_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> +{
>>> +       struct efx_vring_dyn_cfg vring_dyn_cfg;
>>> +       struct efx_vring_cfg vring_cfg;
>>> +       int rc;
>>> +
>>> +       rc = irq_vring_init(vdpa_nic, idx);
>>> +       if (rc) {
>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>> +                       "%s: irq_vring_init failed. index:%u,
>>> err:%d\n",
>>> +                       __func__, idx, rc);
>>> +               return rc;
>>> +       }
>>> +       vring_cfg.desc = vdpa_nic->vring[idx].desc;
>>> +       vring_cfg.avail = vdpa_nic->vring[idx].avail;
>>> +       vring_cfg.used = vdpa_nic->vring[idx].used;
>>> +       vring_cfg.size = vdpa_nic->vring[idx].size;
>>> +       vring_cfg.features = vdpa_nic->features;
>>> +       vring_cfg.msix_vector = idx;
>>> +       vring_dyn_cfg.avail_idx = vdpa_nic->vring[idx].last_avail_idx;
>>> +       vring_dyn_cfg.used_idx = vdpa_nic->vring[idx].last_used_idx;
>>> +
>>> +       rc = efx_vdpa_vring_create(vdpa_nic->vring[idx].vring_ctx,
>>> +                                  &vring_cfg, &vring_dyn_cfg);
>>> +       if (rc) {
>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>> +                       "%s: vring_create failed index:%u, err:%d\n",
>>> +                       __func__, idx, rc);
>>> +               goto err_vring_create;
>>> +       }
>>> +       vdpa_nic->vring[idx].vring_state |= EF100_VRING_CREATED;
>>> +
>>> +       /* A VQ kick allows the device to read the avail_idx, which
>>> will be
>>> +        * required at the destination after live migration.
>>> +        */
>>> +       ef100_vdpa_kick_vq(&vdpa_nic->vdpa_dev, idx);
>>> +
>>> +       return 0;
>>> +
>>> +err_vring_create:
>>> +       irq_vring_fini(vdpa_nic, idx);
>>> +       return rc;
>>> +}
>>> +
>>> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> +{
>>> +       delete_vring(vdpa_nic, idx);
>>> +       vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>>> +       vdpa_nic->vring[idx].vring_state = 0;
>>> +       vdpa_nic->vring[idx].last_avail_idx = 0;
>>> +       vdpa_nic->vring[idx].last_used_idx = 0;
>>> +}
>>> +
>>> +static void ef100_reset_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>>> +{
>>> +       int i;
>>> +
>>> +       WARN_ON(!mutex_is_locked(&vdpa_nic->lock));
>>> +
>>> +       if (!vdpa_nic->status)
>>> +               return;
>>> +
>>> +       vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
>>> +       vdpa_nic->status = 0;
>>> +       vdpa_nic->features = 0;
>>> +       for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++)
>>> +               reset_vring(vdpa_nic, i);
>>> + ef100_vdpa_irq_vectors_free(vdpa_nic->efx->pci_dev);
>>> +}
>>> +
>>> +/* May be called under the rtnl lock */
>>> +int ef100_vdpa_reset(struct vdpa_device *vdev)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +
>>> +       /* vdpa device can be deleted anytime but the bar_config
>>> +        * could still be vdpa and hence efx->state would be
>>> STATE_VDPA.
>>> +        * Accordingly, ensure vdpa device exists before reset handling
>>> +        */
>>> +       if (!vdpa_nic)
>>> +               return -ENODEV;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       ef100_reset_vdpa_device(vdpa_nic);
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +       return 0;
>>> +}
>>> +
>>> +static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>>> +{
>>> +       struct efx_nic *efx = vdpa_nic->efx;
>>> +       struct ef100_nic_data *nic_data;
>>> +       int i, j;
>>> +       int rc;
>>> +
>>> +       nic_data = efx->nic_data;
>>> +       rc = ef100_vdpa_irq_vectors_alloc(efx->pci_dev,
>>> + vdpa_nic->max_queue_pairs * 2);
>>> +       if (rc < 0) {
>>> +               pci_err(efx->pci_dev,
>>> +                       "vDPA IRQ alloc failed for vf: %u err:%d\n",
>>> +                       nic_data->vf_index, rc);
>>> +               return rc;
>>> +       }
>>> +
>>> +       for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>>> +               if (can_create_vring(vdpa_nic, i)) {
>>> +                       rc = create_vring(vdpa_nic, i);
>>> +                       if (rc)
>>> +                               goto clear_vring;
>>> +               }
>>> +       }
>>> +
>>> +       vdpa_nic->vdpa_state = EF100_VDPA_STATE_STARTED;
>> It looks to me that this duplicates with the DRIVER_OK status bit.
> vdpa_state is set EF100_VDPA_STATE_STARTED during DRIVER_OK handling.
> See my later response for its purpose.
>>
>>> +       return 0;
>>> +
>>> +clear_vring:
>>> +       for (j = 0; j < i; j++)
>>> +               delete_vring(vdpa_nic, j);
>>> +
>>> +       ef100_vdpa_irq_vectors_free(efx->pci_dev);
>>> +       return rc;
>>> +}
>>> +
>>>   static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
>>>                                       u16 idx, u64 desc_area, u64
>>> driver_area,
>>>                                       u64 device_area)
>>> @@ -144,22 +361,6 @@ static void ef100_vdpa_set_vq_num(struct
>>> vdpa_device *vdev, u16 idx, u32 num)
>>>          mutex_unlock(&vdpa_nic->lock);
>>>   }
>>>
>>> -static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>>> -{
>>> -       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> -       u32 idx_val;
>>> -
>>> -       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> -               return;
>>> -
>>> -       if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>>> -               return;
>>> -
>>> -       idx_val = idx;
>>> -       _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>>> -                   vdpa_nic->vring[idx].doorbell_offset);
>>> -}
>>> -
>>>   static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
>>>                                   struct vdpa_callback *cb)
>>>   {
>>> @@ -176,6 +377,7 @@ static void ef100_vdpa_set_vq_ready(struct
>>> vdpa_device *vdev, u16 idx,
>>>                                      bool ready)
>>>   {
>>>          struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       int rc;
>>>
>>>          if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>                  return;
>>> @@ -184,9 +386,21 @@ static void ef100_vdpa_set_vq_ready(struct
>>> vdpa_device *vdev, u16 idx,
>>>          if (ready) {
>>>                  vdpa_nic->vring[idx].vring_state |=
>>> EF100_VRING_READY_CONFIGURED;
>>> +               if (vdpa_nic->vdpa_state == EF100_VDPA_STATE_STARTED &&
>>> +                   can_create_vring(vdpa_nic, idx)) {
>>> +                       rc = create_vring(vdpa_nic, idx);
>>> +                       if (rc)
>>> +                               /* Rollback ready configuration
>>> +                                * So that the above layer driver
>>> +                                * can make another attempt to set
>>> ready
>>> +                                */
>>> + vdpa_nic->vring[idx].vring_state &=
>>> + ~EF100_VRING_READY_CONFIGURED;
>>> +               }
>>>          } else {
>>>                  vdpa_nic->vring[idx].vring_state &=
>>> ~EF100_VRING_READY_CONFIGURED;
>>> +               delete_vring(vdpa_nic, idx);
>>>          }
>>>          mutex_unlock(&vdpa_nic->lock);
>>>   }
>>> @@ -296,6 +510,12 @@ static u64
>>> ef100_vdpa_get_device_features(struct vdpa_device *vdev)
>>>          }
>>>
>>>          features |= BIT_ULL(VIRTIO_NET_F_MAC);
>>> +       /* As QEMU SVQ doesn't implement the following features,
>>> +        * masking them off to allow Live Migration
>>> +        */
>>> +       features &= ~BIT_ULL(VIRTIO_F_IN_ORDER);
>>> +       features &= ~BIT_ULL(VIRTIO_F_ORDER_PLATFORM);
>> It's better not to work around userspace bugs in the kernel. We should
>> fix Qemu instead.
>
> There's already a QEMU patch [1] submitted to support
> VIRTIO_F_ORDER_PLATFORM but it hasn't concluded yet. Also, there is no
> support for VIRTIO_F_IN_ORDER in the kernel virtio driver. The motive
> of this change is to have VM Live Migration working with the kernel
> in-tree driver without requiring any changes.
>
> Once QEMU is able to handle these features, we can submit a patch to
> undo these changes.


I can understand the motivation, but it works for prototyping but not
formal kernel code (especially consider SVQ is not mature and still
being development). What's more, we can not assume Qemu is the only
user, we have other users like DPDK and cloud-hypervisors.

Thanks


>
>>
>>> +
>>>          return features;
>>>   }
>>>
>>> @@ -356,6 +576,77 @@ static u32 ef100_vdpa_get_vendor_id(struct
>>> vdpa_device *vdev)
>>>          return EF100_VDPA_VENDOR_ID;
>>>   }
>>>
>>> +static u8 ef100_vdpa_get_status(struct vdpa_device *vdev)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       u8 status;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       status = vdpa_nic->status;
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +       return status;
>>> +}
>>> +
>>> +static void ef100_vdpa_set_status(struct vdpa_device *vdev, u8 status)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       u8 new_status;
>>> +       int rc;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       if (!status) {
>>> +               dev_info(&vdev->dev,
>>> +                        "%s: Status received is 0. Device reset
>>> being done\n",
>>> +                        __func__);
>> This is trigger-able by the userspace. It might be better to use
>> dev_dbg() instead.
> Will change.
>>
>>> + ef100_reset_vdpa_device(vdpa_nic);
>>> +               goto unlock_return;
>>> +       }
>>> +       new_status = status & ~vdpa_nic->status;
>>> +       if (new_status == 0) {
>>> +               dev_info(&vdev->dev,
>>> +                        "%s: New status same as current status\n",
>>> __func__);
>> Same here.
> Ok.
>>
>>> +               goto unlock_return;
>>> +       }
>>> +       if (new_status & VIRTIO_CONFIG_S_FAILED) {
>>> +               ef100_reset_vdpa_device(vdpa_nic);
>>> +               goto unlock_return;
>>> +       }
>>> +
>>> +       if (new_status & VIRTIO_CONFIG_S_ACKNOWLEDGE) {
>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_ACKNOWLEDGE;
>>> +               new_status &= ~VIRTIO_CONFIG_S_ACKNOWLEDGE;
>>> +       }
>>> +       if (new_status & VIRTIO_CONFIG_S_DRIVER) {
>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER;
>>> +               new_status &= ~VIRTIO_CONFIG_S_DRIVER;
>>> +       }
>>> +       if (new_status & VIRTIO_CONFIG_S_FEATURES_OK) {
>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_FEATURES_OK;
>>> +               vdpa_nic->vdpa_state = EF100_VDPA_STATE_NEGOTIATED;
>> It might be better to explain the reason we need to track another
>> state in vdpa_state instead of simply using the device status.
> vdpa_state helps to ensure correct status transitions in the
> .set_status callback and safe-guards against incorrect/malicious
> user-space driver.


Ok, let's document this in the definition of vdpa_state.


>>
>>> +               new_status &= ~VIRTIO_CONFIG_S_FEATURES_OK;
>>> +       }
>>> +       if (new_status & VIRTIO_CONFIG_S_DRIVER_OK &&
>>> +           vdpa_nic->vdpa_state == EF100_VDPA_STATE_NEGOTIATED) {
>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER_OK;
>>> +               rc = start_vdpa_device(vdpa_nic);
>>> +               if (rc) {
>>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>>> +                               "%s: vDPA device failed:%d\n",
>>> __func__, rc);
>>> +                       vdpa_nic->status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
>>> +                       goto unlock_return;
>>> +               }
>>> +               new_status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
>>> +       }
>>> +       if (new_status) {
>>> +               dev_warn(&vdev->dev,
>>> +                        "%s: Mismatch Status: %x & State: %u\n",
>>> +                        __func__, new_status, vdpa_nic->vdpa_state);
>>> +       }
>>> +
>>> +unlock_return:
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +}
>>> +
>>>   static size_t ef100_vdpa_get_config_size(struct vdpa_device *vdev)
>>>   {
>>>          return sizeof(struct virtio_net_config);
>>> @@ -393,6 +684,20 @@ static void ef100_vdpa_set_config(struct
>>> vdpa_device *vdev, unsigned int offset,
>>>                  vdpa_nic->mac_configured = true;
>>>   }
>>>
>>> +static int ef100_vdpa_suspend(struct vdpa_device *vdev)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       int i, rc;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>>> +               rc = delete_vring(vdpa_nic, i);
>> Note that the suspension matters for the whole device. It means the
>> config space should not be changed. But the code here only suspends
>> the vring, is this intende/d?
> Are you referring to the possibility of updating device configuration
> (eg. MAC address) using .set_config() after suspend operation? Is
> there any other user triggered operation that falls in this category?


Updating MAC should be prohibited, one typical use case is the link status.


>>
>> Reset may have the same issue.
> Could you pls elaborate on the requirement during device reset?


I meant ef100_reset_vdpa_device() may suffer from the same issue:

It only reset all the vring but not the config space?

Thanks


>>
>> Thanks
> [1]
> https://patchew.org/QEMU/[email protected]/
>>
>>> +               if (rc)
>>> +                       break;
>>> +       }
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +       return rc;
>>> +}
>>>   static void ef100_vdpa_free(struct vdpa_device *vdev)
>>>   {
>>>          struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> @@ -428,9 +733,13 @@ const struct vdpa_config_ops
>>> ef100_vdpa_config_ops = {
>>>          .get_vq_num_max      = ef100_vdpa_get_vq_num_max,
>>>          .get_device_id       = ef100_vdpa_get_device_id,
>>>          .get_vendor_id       = ef100_vdpa_get_vendor_id,
>>> +       .get_status          = ef100_vdpa_get_status,
>>> +       .set_status          = ef100_vdpa_set_status,
>>> +       .reset               = ef100_vdpa_reset,
>>>          .get_config_size     = ef100_vdpa_get_config_size,
>>>          .get_config          = ef100_vdpa_get_config,
>>>          .set_config          = ef100_vdpa_set_config,
>>>          .get_generation      = NULL,
>>> +       .suspend             = ef100_vdpa_suspend,
>>>          .free                = ef100_vdpa_free,
>>>   };
>>> --
>>> 2.30.1
>>>
>


2023-03-15 05:09:50

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 08/14] sfc: implement vdpa vring config operations


在 2023/3/13 20:33, Gautam Dawar 写道:
>
> On 3/10/23 10:34, Jason Wang wrote:
>> Caution: This message originated from an External Source. Use proper
>> caution when opening attachments, clicking links, or responding.
>>
>>
>> On Tue, Mar 7, 2023 at 7:37 PM Gautam Dawar <[email protected]>
>> wrote:
>>> This patch implements the vDPA config operations related to
>>> virtqueues or vrings. These include setting vring address,
>>> getting vq state, operations to enable/disable a vq etc.
>>> The resources required for vring operations eg. VI, interrupts etc.
>>> are also allocated.
>>>
>>> Signed-off-by: Gautam Dawar <[email protected]>
>>> ---
>>>   drivers/net/ethernet/sfc/ef100_vdpa.c     |  46 +++-
>>>   drivers/net/ethernet/sfc/ef100_vdpa.h     |  54 +++++
>>>   drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 275
>>> ++++++++++++++++++++++
>>>   3 files changed, 374 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> index 4c5a98c9d6c3..c66e5aef69ea 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>> @@ -14,6 +14,7 @@
>>>   #include "ef100_vdpa.h"
>>>   #include "mcdi_vdpa.h"
>>>   #include "mcdi_filters.h"
>>> +#include "mcdi_functions.h"
>>>   #include "ef100_netdev.h"
>>>
>>>   static struct virtio_device_id ef100_vdpa_id_table[] = {
>>> @@ -47,12 +48,31 @@ int ef100_vdpa_init(struct efx_probe_data
>>> *probe_data)
>>>          return rc;
>>>   }
>>>
>>> +static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int
>>> *allocated_vis)
>>> +{
>>> +       /* The first VI is reserved for MCDI
>>> +        * 1 VI each for rx + tx ring
>>> +        */
>>> +       unsigned int max_vis = 1 + EF100_VDPA_MAX_QUEUES_PAIRS;
>>> +       unsigned int min_vis = 1 + 1;
>>> +       int rc;
>>> +
>>> +       rc = efx_mcdi_alloc_vis(efx, min_vis, max_vis,
>>> +                               NULL, allocated_vis);
>>> +       if (!rc)
>>> +               return rc;
>>> +       if (*allocated_vis < min_vis)
>>> +               return -ENOSPC;
>>> +       return 0;
>>> +}
>>> +
>>>   static void ef100_vdpa_delete(struct efx_nic *efx)
>>>   {
>>>          if (efx->vdpa_nic) {
>>>                  /* replace with _vdpa_unregister_device later */
>>> put_device(&efx->vdpa_nic->vdpa_dev.dev);
>>>          }
>>> +       efx_mcdi_free_vis(efx);
>>>   }
>>>
>>>   void ef100_vdpa_fini(struct efx_probe_data *probe_data)
>>> @@ -104,9 +124,19 @@ static struct ef100_vdpa_nic
>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>   {
>>>          struct ef100_nic_data *nic_data = efx->nic_data;
>>>          struct ef100_vdpa_nic *vdpa_nic;
>>> +       unsigned int allocated_vis;
>>>          int rc;
>>> +       u8 i;
>>>
>>>          nic_data->vdpa_class = dev_type;
>>> +       rc = vdpa_allocate_vis(efx, &allocated_vis);
>>> +       if (rc) {
>>> +               pci_err(efx->pci_dev,
>>> +                       "%s Alloc VIs failed for vf:%u error:%d\n",
>>> +                        __func__, nic_data->vf_index, rc);
>>> +               return ERR_PTR(rc);
>>> +       }
>>> +
>>>          vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
>>>                                       vdpa_dev, &efx->pci_dev->dev,
>>> &ef100_vdpa_config_ops,
>>> @@ -117,7 +147,8 @@ static struct ef100_vdpa_nic
>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>                          "vDPA device allocation failed for vf: %u\n",
>>>                          nic_data->vf_index);
>>>                  nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
>>> -               return ERR_PTR(-ENOMEM);
>>> +               rc = -ENOMEM;
>>> +               goto err_alloc_vis_free;
>>>          }
>>>
>>>          mutex_init(&vdpa_nic->lock);
>>> @@ -125,11 +156,21 @@ static struct ef100_vdpa_nic
>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>          vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
>>>          vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
>>>          vdpa_nic->efx = efx;
>>> +       vdpa_nic->max_queue_pairs = allocated_vis - 1;
>>>          vdpa_nic->pf_index = nic_data->pf_index;
>>>          vdpa_nic->vf_index = nic_data->vf_index;
>>>          vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
>>>          vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;
>>>
>>> +       for (i = 0; i < (2 * vdpa_nic->max_queue_pairs); i++) {
>>> +               rc = ef100_vdpa_init_vring(vdpa_nic, i);
>>> +               if (rc) {
>>> +                       pci_err(efx->pci_dev,
>>> +                               "vring init idx: %u failed, rc:
>>> %d\n", i, rc);
>>> +                       goto err_put_device;
>>> +               }
>>> +       }
>>> +
>>>          rc = get_net_config(vdpa_nic);
>>>          if (rc)
>>>                  goto err_put_device;
>>> @@ -146,6 +187,9 @@ static struct ef100_vdpa_nic
>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>   err_put_device:
>>>          /* put_device invokes ef100_vdpa_free */
>>>          put_device(&vdpa_nic->vdpa_dev.dev);
>>> +
>>> +err_alloc_vis_free:
>>> +       efx_mcdi_free_vis(efx);
>>>          return ERR_PTR(rc);
>>>   }
>>>
>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> index dcf4a8156415..348ca8a7404b 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>> @@ -32,6 +32,21 @@
>>>   /* Alignment requirement of the Virtqueue */
>>>   #define EF100_VDPA_VQ_ALIGN 4096
>>>
>>> +/* Vring configuration definitions */
>>> +#define EF100_VRING_ADDRESS_CONFIGURED 0x1
>>> +#define EF100_VRING_SIZE_CONFIGURED 0x10
>>> +#define EF100_VRING_READY_CONFIGURED 0x100
>>> +#define EF100_VRING_CONFIGURED (EF100_VRING_ADDRESS_CONFIGURED | \
>>> +                               EF100_VRING_SIZE_CONFIGURED | \
>>> +                               EF100_VRING_READY_CONFIGURED)
>>> +#define EF100_VRING_CREATED 0x1000
>>> +
>>> +/* Maximum size of msix name */
>>> +#define EF100_VDPA_MAX_MSIX_NAME_SIZE 256
>>> +
>>> +/* Default high IOVA for MCDI buffer */
>>> +#define EF100_VDPA_IOVA_BASE_ADDR 0x20000000000
>>> +
>>>   /**
>>>    * enum ef100_vdpa_nic_state - possible states for a vDPA NIC
>>>    *
>>> @@ -57,6 +72,41 @@ enum ef100_vdpa_vq_type {
>>>          EF100_VDPA_VQ_NTYPES
>>>   };
>>>
>>> +/**
>>> + * struct ef100_vdpa_vring_info - vDPA vring data structure
>>> + *
>>> + * @desc: Descriptor area address of the vring
>>> + * @avail: Available area address of the vring
>>> + * @used: Device area address of the vring
>>> + * @size: Number of entries in the vring
>>> + * @vring_state: bit map to track vring configuration
>>> + * @last_avail_idx: last available index of the vring
>>> + * @last_used_idx: last used index of the vring
>>> + * @doorbell_offset: doorbell offset
>>> + * @doorbell_offset_valid: true if @doorbell_offset is updated
>>> + * @vring_type: type of vring created
>>> + * @vring_ctx: vring context information
>>> + * @msix_name: device name for vring irq handler
>>> + * @irq: irq number for vring irq handler
>>> + * @cb: callback for vring interrupts
>>> + */
>>> +struct ef100_vdpa_vring_info {
>>> +       dma_addr_t desc;
>>> +       dma_addr_t avail;
>>> +       dma_addr_t used;
>>> +       u32 size;
>>> +       u16 vring_state;
>>> +       u32 last_avail_idx;
>>> +       u32 last_used_idx;
>>> +       u32 doorbell_offset;
>>> +       bool doorbell_offset_valid;
>>> +       enum ef100_vdpa_vq_type vring_type;
>>> +       struct efx_vring_ctx *vring_ctx;
>>> +       char msix_name[EF100_VDPA_MAX_MSIX_NAME_SIZE];
>>> +       u32 irq;
>>> +       struct vdpa_callback cb;
>>> +};
>>> +
>>>   /**
>>>    *  struct ef100_vdpa_nic - vDPA NIC data structure
>>>    *
>>> @@ -70,6 +120,7 @@ enum ef100_vdpa_vq_type {
>>>    * @features: negotiated feature bits
>>>    * @max_queue_pairs: maximum number of queue pairs supported
>>>    * @net_config: virtio_net_config data
>>> + * @vring: vring information of the vDPA device.
>>>    * @mac_address: mac address of interface associated with this
>>> vdpa device
>>>    * @mac_configured: true after MAC address is configured
>>>    * @cfg_cb: callback for config change
>>> @@ -86,6 +137,7 @@ struct ef100_vdpa_nic {
>>>          u64 features;
>>>          u32 max_queue_pairs;
>>>          struct virtio_net_config net_config;
>>> +       struct ef100_vdpa_vring_info
>>> vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
>>>          u8 *mac_address;
>>>          bool mac_configured;
>>>          struct vdpa_callback cfg_cb;
>>> @@ -95,6 +147,8 @@ int ef100_vdpa_init(struct efx_probe_data
>>> *probe_data);
>>>   void ef100_vdpa_fini(struct efx_probe_data *probe_data);
>>>   int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
>>>   void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
>>> +void ef100_vdpa_irq_vectors_free(void *data);
>>> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>>>
>>>   static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic
>>> *vdpa_nic)
>>>   {
>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> index a2364ef9f492..0051c4c0e47c 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>> @@ -9,13 +9,270 @@
>>>
>>>   #include <linux/vdpa.h>
>>>   #include "ef100_vdpa.h"
>>> +#include "io.h"
>>>   #include "mcdi_vdpa.h"
>>>
>>> +/* Get the queue's function-local index of the associated VI
>>> + * virtqueue number queue 0 is reserved for MCDI
>>> + */
>>> +#define EFX_GET_VI_INDEX(vq_num) (((vq_num) / 2) + 1)
>>> +
>>>   static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
>>>   {
>>>          return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
>>>   }
>>>
>>> +void ef100_vdpa_irq_vectors_free(void *data)
>>> +{
>>> +       pci_free_irq_vectors(data);
>>> +}
>>> +
>>> +static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> +{
>>> +       struct efx_vring_ctx *vring_ctx;
>>> +       u32 vi_index;
>>> +
>>> +       if (idx % 2) /* Even VQ for RX and odd for TX */
>>> +               vdpa_nic->vring[idx].vring_type =
>>> EF100_VDPA_VQ_TYPE_NET_TXQ;
>>> +       else
>>> +               vdpa_nic->vring[idx].vring_type =
>>> EF100_VDPA_VQ_TYPE_NET_RXQ;
>>> +       vi_index = EFX_GET_VI_INDEX(idx);
>>> +       vring_ctx = efx_vdpa_vring_init(vdpa_nic->efx, vi_index,
>>> + vdpa_nic->vring[idx].vring_type);
>>> +       if (IS_ERR(vring_ctx))
>>> +               return PTR_ERR(vring_ctx);
>>> +
>>> +       vdpa_nic->vring[idx].vring_ctx = vring_ctx;
>>> +       return 0;
>>> +}
>>> +
>>> +static void delete_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> +{
>>> + efx_vdpa_vring_fini(vdpa_nic->vring[idx].vring_ctx);
>>> +       vdpa_nic->vring[idx].vring_ctx = NULL;
>>> +}
>>> +
>>> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> +{
>>> +       vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>>> +       vdpa_nic->vring[idx].vring_state = 0;
>>> +       vdpa_nic->vring[idx].last_avail_idx = 0;
>>> +       vdpa_nic->vring[idx].last_used_idx = 0;
>>> +}
>>> +
>>> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>> +{
>>> +       u32 offset;
>>> +       int rc;
>>> +
>>> +       vdpa_nic->vring[idx].irq = -EINVAL;
>>> +       rc = create_vring_ctx(vdpa_nic, idx);
>>> +       if (rc) {
>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>> +                       "%s: create_vring_ctx failed, idx:%u,
>>> err:%d\n",
>>> +                       __func__, idx, rc);
>>> +               return rc;
>>> +       }
>>> +
>>> +       rc =
>>> efx_vdpa_get_doorbell_offset(vdpa_nic->vring[idx].vring_ctx,
>>> +                                         &offset);
>>> +       if (rc) {
>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>> +                       "%s: get_doorbell failed idx:%u, err:%d\n",
>>> +                       __func__, idx, rc);
>>> +               goto err_get_doorbell_offset;
>>> +       }
>>> +       vdpa_nic->vring[idx].doorbell_offset = offset;
>>> +       vdpa_nic->vring[idx].doorbell_offset_valid = true;
>>> +
>>> +       return 0;
>>> +
>>> +err_get_doorbell_offset:
>>> +       delete_vring_ctx(vdpa_nic, idx);
>>> +       return rc;
>>> +}
>>> +
>>> +static bool is_qid_invalid(struct ef100_vdpa_nic *vdpa_nic, u16 idx,
>>> +                          const char *caller)
>>> +{
>>> +       if (unlikely(idx >= (vdpa_nic->max_queue_pairs * 2))) {
>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>> +                       "%s: Invalid qid %u\n", caller, idx);
>>> +               return true;
>>> +       }
>>> +       return false;
>>> +}
>>> +
>>> +static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
>>> +                                    u16 idx, u64 desc_area, u64
>>> driver_area,
>>> +                                    u64 device_area)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               return -EINVAL;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       vdpa_nic->vring[idx].desc = desc_area;
>>> +       vdpa_nic->vring[idx].avail = driver_area;
>>> +       vdpa_nic->vring[idx].used = device_area;
>>> +       vdpa_nic->vring[idx].vring_state |=
>>> EF100_VRING_ADDRESS_CONFIGURED;
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +       return 0;
>>> +}
>>> +
>>> +static void ef100_vdpa_set_vq_num(struct vdpa_device *vdev, u16
>>> idx, u32 num)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               return;
>>> +
>>> +       if (!is_power_of_2(num)) {
>>> +               dev_err(&vdev->dev, "%s: Index:%u size:%u not power
>>> of 2\n",
>>> +                       __func__, idx, num);
>>> +               return;
>>> +       }
>> Note that this is not a requirement for packed virtqueue.
>>
>> """
>> Queue Size corresponds to the maximum number of descriptors in the
>> virtqueue5. The Queue Size value does not have to be a power of 2.
>> """
> Yes, but we are using split vrings and virtio spec states "Queue Size
> value is always a power of 2" for Split virtqueues.


Did you mean the device can only support split virtqueue? If yes, we'd
better document this.

But this seems not scalable consider the packed virtqueue could be
supported in the future. It would be nice if device can fail the command
according to the type of the virtqueue, then the driver doesn't need any
care about this.


>>
>>> +       if (num > EF100_VDPA_VQ_NUM_MAX_SIZE) {
>>> +               dev_err(&vdev->dev, "%s: Index:%u size:%u more than
>>> max:%u\n",
>>> +                       __func__, idx, num,
>>> EF100_VDPA_VQ_NUM_MAX_SIZE);
>>> +               return;
>>> +       }
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       vdpa_nic->vring[idx].size  = num;
>>> +       vdpa_nic->vring[idx].vring_state |=
>>> EF100_VRING_SIZE_CONFIGURED;
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +}
>>> +
>>> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       u32 idx_val;
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               return;
>>> +
>>> +       if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>>> +               return;
>> In which case could we hit this condition?
> I've noticed this condition in regular testing with vhost-vdpa. The
> first couple of kick_vq calls arrive when the HW queues aren't created
> yet. .I think userspace assumes queues to be ready soon after sending
> DRIVER_OK. However, there is a little time window between that and
> when the HW VQs are actually ready for datapath.


Interesting, so I think the driver need to wait until the HW VQS are
ready before return from DRIVER_OK setting in this case. Otherwise we
may end up with the above check (and it probably lacks some kind of
synchronization).


>>
>>> +
>>> +       idx_val = idx;
>>> +       _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>>> +                   vdpa_nic->vring[idx].doorbell_offset);
>>> +}
>>> +
>>> +static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
>>> +                                struct vdpa_callback *cb)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               return;
>>> +
>>> +       if (cb)
>>> +               vdpa_nic->vring[idx].cb = *cb;
>>> +}
>>> +
>>> +static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx,
>>> +                                   bool ready)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               return;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       if (ready) {
>>> +               vdpa_nic->vring[idx].vring_state |=
>>> + EF100_VRING_READY_CONFIGURED;
>> I think it would be sufficient to have EF100_VRING_READY_CONFIGURED
>> here. With this set, the device can think the vq configuration is done
>> by the driver.
>>
>> Or is there anything special for size and num?
> The virtqueue is considered ready for datapath when it is fully
> configured (both size and address set and enabled with set_vq_ready).
> Depending on merely the queue enable (EF100_VRING_READY_CONFIGURED)
> would assume valid values for vq size and addresses, which we wish to
> avoid.


Ok, but I'd say it's better to offload those to the device. According to
the spec, once queue_enable is set, the device assumes the virtqueue
configuration is ready (no matter if size and num are configured). And
driver risks its own for wrong configuration and device should be ready
for invalid configuration (this is even the case with the above codes,
device should still need to care about illegal size and num).

Thanks


>>
>> Thanks
>>
>>
>>> +       } else {
>>> +               vdpa_nic->vring[idx].vring_state &=
>>> + ~EF100_VRING_READY_CONFIGURED;
>>> +       }
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +}
>>> +
>>> +static bool ef100_vdpa_get_vq_ready(struct vdpa_device *vdev, u16 idx)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       bool ready;
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               return false;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       ready = vdpa_nic->vring[idx].vring_state &
>>> EF100_VRING_READY_CONFIGURED;
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +       return ready;
>>> +}
>>> +
>>> +static int ef100_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx,
>>> +                                  const struct vdpa_vq_state *state)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               return -EINVAL;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       vdpa_nic->vring[idx].last_avail_idx = state->split.avail_index;
>>> +       vdpa_nic->vring[idx].last_used_idx = state->split.avail_index;
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +       return 0;
>>> +}
>>> +
>>> +static int ef100_vdpa_get_vq_state(struct vdpa_device *vdev,
>>> +                                  u16 idx, struct vdpa_vq_state
>>> *state)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               return -EINVAL;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       state->split.avail_index =
>>> (u16)vdpa_nic->vring[idx].last_used_idx;
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +
>>> +       return 0;
>>> +}
>>> +
>>> +static struct vdpa_notification_area
>>> +               ef100_vdpa_get_vq_notification(struct vdpa_device
>>> *vdev,
>>> +                                              u16 idx)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       struct vdpa_notification_area notify_area = {0, 0};
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               goto end;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       notify_area.addr = (uintptr_t)(vdpa_nic->efx->membase_phys +
>>> + vdpa_nic->vring[idx].doorbell_offset);
>>> +       /* VDPA doorbells are at a stride of VI/2
>>> +        * One VI stride is shared by both rx & tx doorbells
>>> +        */
>>> +       notify_area.size = vdpa_nic->efx->vi_stride / 2;
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +
>>> +end:
>>> +       return notify_area;
>>> +}
>>> +
>>> +static int ef100_get_vq_irq(struct vdpa_device *vdev, u16 idx)
>>> +{
>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       u32 irq;
>>> +
>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>> +               return -EINVAL;
>>> +
>>> +       mutex_lock(&vdpa_nic->lock);
>>> +       irq = vdpa_nic->vring[idx].irq;
>>> +       mutex_unlock(&vdpa_nic->lock);
>>> +
>>> +       return irq;
>>> +}
>>> +
>>>   static u32 ef100_vdpa_get_vq_align(struct vdpa_device *vdev)
>>>   {
>>>          return EF100_VDPA_VQ_ALIGN;
>>> @@ -80,6 +337,8 @@ static void ef100_vdpa_set_config_cb(struct
>>> vdpa_device *vdev,
>>>
>>>          if (cb)
>>>                  vdpa_nic->cfg_cb = *cb;
>>> +       else
>>> +               memset(&vdpa_nic->cfg_cb, 0, sizeof(vdpa_nic->cfg_cb));
>>>   }
>>>
>>>   static u16 ef100_vdpa_get_vq_num_max(struct vdpa_device *vdev)
>>> @@ -137,14 +396,30 @@ static void ef100_vdpa_set_config(struct
>>> vdpa_device *vdev, unsigned int offset,
>>>   static void ef100_vdpa_free(struct vdpa_device *vdev)
>>>   {
>>>          struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>> +       int i;
>>>
>>>          if (vdpa_nic) {
>>> +               for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>>> +                       reset_vring(vdpa_nic, i);
>>> +                       if (vdpa_nic->vring[i].vring_ctx)
>>> +                               delete_vring_ctx(vdpa_nic, i);
>>> +               }
>>>                  mutex_destroy(&vdpa_nic->lock);
>>>                  vdpa_nic->efx->vdpa_nic = NULL;
>>>          }
>>>   }
>>>
>>>   const struct vdpa_config_ops ef100_vdpa_config_ops = {
>>> +       .set_vq_address      = ef100_vdpa_set_vq_address,
>>> +       .set_vq_num          = ef100_vdpa_set_vq_num,
>>> +       .kick_vq             = ef100_vdpa_kick_vq,
>>> +       .set_vq_cb           = ef100_vdpa_set_vq_cb,
>>> +       .set_vq_ready        = ef100_vdpa_set_vq_ready,
>>> +       .get_vq_ready        = ef100_vdpa_get_vq_ready,
>>> +       .set_vq_state        = ef100_vdpa_set_vq_state,
>>> +       .get_vq_state        = ef100_vdpa_get_vq_state,
>>> +       .get_vq_notification = ef100_vdpa_get_vq_notification,
>>> +       .get_vq_irq          = ef100_get_vq_irq,
>>>          .get_vq_align        = ef100_vdpa_get_vq_align,
>>>          .get_device_features = ef100_vdpa_get_device_features,
>>>          .set_driver_features = ef100_vdpa_set_driver_features,
>>> --
>>> 2.30.1
>>>
>


2023-03-15 05:12:31

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 01/14] sfc: add function personality support for EF100 devices


在 2023/3/13 19:50, Martin Habets 写道:
> On Fri, Mar 10, 2023 at 01:04:14PM +0800, Jason Wang wrote:
>> On Tue, Mar 7, 2023 at 7:36 PM Gautam Dawar <[email protected]> wrote:
>>> A function personality defines the location and semantics of
>>> registers in the BAR. EF100 NICs allow different personalities
>>> of a PCIe function and changing it at run-time. A total of three
>>> function personalities are defined as of now: EF100, vDPA and
>>> None with EF100 being the default.
>>> For now, vDPA net devices can be created on a EF100 virtual
>>> function and the VF personality will be changed to vDPA in the
>>> process.
>>>
>>> Co-developed-by: Martin Habets <[email protected]>
>>> Signed-off-by: Martin Habets <[email protected]>
>>> Signed-off-by: Gautam Dawar <[email protected]>
>>> ---
>>> drivers/net/ethernet/sfc/ef100.c | 6 +-
>>> drivers/net/ethernet/sfc/ef100_nic.c | 98 +++++++++++++++++++++++++++-
>>> drivers/net/ethernet/sfc/ef100_nic.h | 11 ++++
>>> 3 files changed, 111 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
>>> index 71aab3d0480f..c1c69783db7b 100644
>>> --- a/drivers/net/ethernet/sfc/ef100.c
>>> +++ b/drivers/net/ethernet/sfc/ef100.c
>>> @@ -429,8 +429,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
>>> if (!efx)
>>> return;
>>>
>>> - probe_data = container_of(efx, struct efx_probe_data, efx);
>>> - ef100_remove_netdev(probe_data);
>>> + efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_NONE);
>>> #ifdef CONFIG_SFC_SRIOV
>>> efx_fini_struct_tc(efx);
>>> #endif
>>> @@ -443,6 +442,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
>>> pci_disable_pcie_error_reporting(pci_dev);
>>>
>>> pci_set_drvdata(pci_dev, NULL);
>>> + probe_data = container_of(efx, struct efx_probe_data, efx);
>>> efx_fini_struct(efx);
>>> kfree(probe_data);
>>> };
>>> @@ -508,7 +508,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
>>> goto fail;
>>>
>>> efx->state = STATE_PROBED;
>>> - rc = ef100_probe_netdev(probe_data);
>>> + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
>>> if (rc)
>>> goto fail;
>>>
>>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
>>> index 4dc643b0d2db..8cbe5e0f4bdf 100644
>>> --- a/drivers/net/ethernet/sfc/ef100_nic.c
>>> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
>>> @@ -772,6 +772,99 @@ static int efx_ef100_get_base_mport(struct efx_nic *efx)
>>> return 0;
>>> }
>>>
>>> +/* BAR configuration.
>>> + * To change BAR configuration, tear down the current configuration (which
>>> + * leaves the hardware in the PROBED state), and then initialise the new
>>> + * BAR state.
>>> + */
>>> +struct ef100_bar_config_ops {
>>> + int (*init)(struct efx_probe_data *probe_data);
>>> + void (*fini)(struct efx_probe_data *probe_data);
>>> +};
>>> +
>>> +static const struct ef100_bar_config_ops bar_config_ops[] = {
>>> + [EF100_BAR_CONFIG_EF100] = {
>>> + .init = ef100_probe_netdev,
>>> + .fini = ef100_remove_netdev
>>> + },
>>> +#ifdef CONFIG_SFC_VDPA
>>> + [EF100_BAR_CONFIG_VDPA] = {
>>> + .init = NULL,
>>> + .fini = NULL
>>> + },
>>> +#endif
>>> + [EF100_BAR_CONFIG_NONE] = {
>>> + .init = NULL,
>>> + .fini = NULL
>>> + },
>>> +};
>> This looks more like a mini bus implementation. I wonder if we can
>> reuse an auxiliary bus here which is more user friendly for management
>> tools.
> When we were in the design phase of vDPA for EF100 it was still called
> virtbus, and the virtbus discussion was in full swing at that time.
> We could not afford to add risk to the project by depending on it, as
> it might not have been merged at all.


Right.


> If we were doing the same design now I would definitely consider using
> the auxiliary bus.
>
> Martin


But it's not late to do the change now. Auxiliary bus has been used by a
lot of devices (even with vDPA device). The change looks not too
complicated.

This looks more scalable and convenient for management layer.

Thanks



2023-03-15 17:07:43

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 08/14] sfc: implement vdpa vring config operations


On 3/15/23 10:38, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> 在 2023/3/13 20:33, Gautam Dawar 写道:
>>
>> On 3/10/23 10:34, Jason Wang wrote:
>>> Caution: This message originated from an External Source. Use proper
>>> caution when opening attachments, clicking links, or responding.
>>>
>>>
>>> On Tue, Mar 7, 2023 at 7:37 PM Gautam Dawar <[email protected]>
>>> wrote:
>>>> This patch implements the vDPA config operations related to
>>>> virtqueues or vrings. These include setting vring address,
>>>> getting vq state, operations to enable/disable a vq etc.
>>>> The resources required for vring operations eg. VI, interrupts etc.
>>>> are also allocated.
>>>>
>>>> Signed-off-by: Gautam Dawar <[email protected]>
>>>> ---
>>>>   drivers/net/ethernet/sfc/ef100_vdpa.c     |  46 +++-
>>>>   drivers/net/ethernet/sfc/ef100_vdpa.h     |  54 +++++
>>>>   drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 275
>>>> ++++++++++++++++++++++
>>>>   3 files changed, 374 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>> b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>> index 4c5a98c9d6c3..c66e5aef69ea 100644
>>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>> @@ -14,6 +14,7 @@
>>>>   #include "ef100_vdpa.h"
>>>>   #include "mcdi_vdpa.h"
>>>>   #include "mcdi_filters.h"
>>>> +#include "mcdi_functions.h"
>>>>   #include "ef100_netdev.h"
>>>>
>>>>   static struct virtio_device_id ef100_vdpa_id_table[] = {
>>>> @@ -47,12 +48,31 @@ int ef100_vdpa_init(struct efx_probe_data
>>>> *probe_data)
>>>>          return rc;
>>>>   }
>>>>
>>>> +static int vdpa_allocate_vis(struct efx_nic *efx, unsigned int
>>>> *allocated_vis)
>>>> +{
>>>> +       /* The first VI is reserved for MCDI
>>>> +        * 1 VI each for rx + tx ring
>>>> +        */
>>>> +       unsigned int max_vis = 1 + EF100_VDPA_MAX_QUEUES_PAIRS;
>>>> +       unsigned int min_vis = 1 + 1;
>>>> +       int rc;
>>>> +
>>>> +       rc = efx_mcdi_alloc_vis(efx, min_vis, max_vis,
>>>> +                               NULL, allocated_vis);
>>>> +       if (!rc)
>>>> +               return rc;
>>>> +       if (*allocated_vis < min_vis)
>>>> +               return -ENOSPC;
>>>> +       return 0;
>>>> +}
>>>> +
>>>>   static void ef100_vdpa_delete(struct efx_nic *efx)
>>>>   {
>>>>          if (efx->vdpa_nic) {
>>>>                  /* replace with _vdpa_unregister_device later */
>>>> put_device(&efx->vdpa_nic->vdpa_dev.dev);
>>>>          }
>>>> +       efx_mcdi_free_vis(efx);
>>>>   }
>>>>
>>>>   void ef100_vdpa_fini(struct efx_probe_data *probe_data)
>>>> @@ -104,9 +124,19 @@ static struct ef100_vdpa_nic
>>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>>   {
>>>>          struct ef100_nic_data *nic_data = efx->nic_data;
>>>>          struct ef100_vdpa_nic *vdpa_nic;
>>>> +       unsigned int allocated_vis;
>>>>          int rc;
>>>> +       u8 i;
>>>>
>>>>          nic_data->vdpa_class = dev_type;
>>>> +       rc = vdpa_allocate_vis(efx, &allocated_vis);
>>>> +       if (rc) {
>>>> +               pci_err(efx->pci_dev,
>>>> +                       "%s Alloc VIs failed for vf:%u error:%d\n",
>>>> +                        __func__, nic_data->vf_index, rc);
>>>> +               return ERR_PTR(rc);
>>>> +       }
>>>> +
>>>>          vdpa_nic = vdpa_alloc_device(struct ef100_vdpa_nic,
>>>>                                       vdpa_dev, &efx->pci_dev->dev,
>>>> &ef100_vdpa_config_ops,
>>>> @@ -117,7 +147,8 @@ static struct ef100_vdpa_nic
>>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>>                          "vDPA device allocation failed for vf: %u\n",
>>>>                          nic_data->vf_index);
>>>>                  nic_data->vdpa_class = EF100_VDPA_CLASS_NONE;
>>>> -               return ERR_PTR(-ENOMEM);
>>>> +               rc = -ENOMEM;
>>>> +               goto err_alloc_vis_free;
>>>>          }
>>>>
>>>>          mutex_init(&vdpa_nic->lock);
>>>> @@ -125,11 +156,21 @@ static struct ef100_vdpa_nic
>>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>>          vdpa_nic->vdpa_dev.dma_dev = &efx->pci_dev->dev;
>>>>          vdpa_nic->vdpa_dev.mdev = efx->mgmt_dev;
>>>>          vdpa_nic->efx = efx;
>>>> +       vdpa_nic->max_queue_pairs = allocated_vis - 1;
>>>>          vdpa_nic->pf_index = nic_data->pf_index;
>>>>          vdpa_nic->vf_index = nic_data->vf_index;
>>>>          vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
>>>>          vdpa_nic->mac_address = (u8 *)&vdpa_nic->net_config.mac;
>>>>
>>>> +       for (i = 0; i < (2 * vdpa_nic->max_queue_pairs); i++) {
>>>> +               rc = ef100_vdpa_init_vring(vdpa_nic, i);
>>>> +               if (rc) {
>>>> +                       pci_err(efx->pci_dev,
>>>> +                               "vring init idx: %u failed, rc:
>>>> %d\n", i, rc);
>>>> +                       goto err_put_device;
>>>> +               }
>>>> +       }
>>>> +
>>>>          rc = get_net_config(vdpa_nic);
>>>>          if (rc)
>>>>                  goto err_put_device;
>>>> @@ -146,6 +187,9 @@ static struct ef100_vdpa_nic
>>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>>   err_put_device:
>>>>          /* put_device invokes ef100_vdpa_free */
>>>>          put_device(&vdpa_nic->vdpa_dev.dev);
>>>> +
>>>> +err_alloc_vis_free:
>>>> +       efx_mcdi_free_vis(efx);
>>>>          return ERR_PTR(rc);
>>>>   }
>>>>
>>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> index dcf4a8156415..348ca8a7404b 100644
>>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> @@ -32,6 +32,21 @@
>>>>   /* Alignment requirement of the Virtqueue */
>>>>   #define EF100_VDPA_VQ_ALIGN 4096
>>>>
>>>> +/* Vring configuration definitions */
>>>> +#define EF100_VRING_ADDRESS_CONFIGURED 0x1
>>>> +#define EF100_VRING_SIZE_CONFIGURED 0x10
>>>> +#define EF100_VRING_READY_CONFIGURED 0x100
>>>> +#define EF100_VRING_CONFIGURED (EF100_VRING_ADDRESS_CONFIGURED | \
>>>> +                               EF100_VRING_SIZE_CONFIGURED | \
>>>> + EF100_VRING_READY_CONFIGURED)
>>>> +#define EF100_VRING_CREATED 0x1000
>>>> +
>>>> +/* Maximum size of msix name */
>>>> +#define EF100_VDPA_MAX_MSIX_NAME_SIZE 256
>>>> +
>>>> +/* Default high IOVA for MCDI buffer */
>>>> +#define EF100_VDPA_IOVA_BASE_ADDR 0x20000000000
>>>> +
>>>>   /**
>>>>    * enum ef100_vdpa_nic_state - possible states for a vDPA NIC
>>>>    *
>>>> @@ -57,6 +72,41 @@ enum ef100_vdpa_vq_type {
>>>>          EF100_VDPA_VQ_NTYPES
>>>>   };
>>>>
>>>> +/**
>>>> + * struct ef100_vdpa_vring_info - vDPA vring data structure
>>>> + *
>>>> + * @desc: Descriptor area address of the vring
>>>> + * @avail: Available area address of the vring
>>>> + * @used: Device area address of the vring
>>>> + * @size: Number of entries in the vring
>>>> + * @vring_state: bit map to track vring configuration
>>>> + * @last_avail_idx: last available index of the vring
>>>> + * @last_used_idx: last used index of the vring
>>>> + * @doorbell_offset: doorbell offset
>>>> + * @doorbell_offset_valid: true if @doorbell_offset is updated
>>>> + * @vring_type: type of vring created
>>>> + * @vring_ctx: vring context information
>>>> + * @msix_name: device name for vring irq handler
>>>> + * @irq: irq number for vring irq handler
>>>> + * @cb: callback for vring interrupts
>>>> + */
>>>> +struct ef100_vdpa_vring_info {
>>>> +       dma_addr_t desc;
>>>> +       dma_addr_t avail;
>>>> +       dma_addr_t used;
>>>> +       u32 size;
>>>> +       u16 vring_state;
>>>> +       u32 last_avail_idx;
>>>> +       u32 last_used_idx;
>>>> +       u32 doorbell_offset;
>>>> +       bool doorbell_offset_valid;
>>>> +       enum ef100_vdpa_vq_type vring_type;
>>>> +       struct efx_vring_ctx *vring_ctx;
>>>> +       char msix_name[EF100_VDPA_MAX_MSIX_NAME_SIZE];
>>>> +       u32 irq;
>>>> +       struct vdpa_callback cb;
>>>> +};
>>>> +
>>>>   /**
>>>>    *  struct ef100_vdpa_nic - vDPA NIC data structure
>>>>    *
>>>> @@ -70,6 +120,7 @@ enum ef100_vdpa_vq_type {
>>>>    * @features: negotiated feature bits
>>>>    * @max_queue_pairs: maximum number of queue pairs supported
>>>>    * @net_config: virtio_net_config data
>>>> + * @vring: vring information of the vDPA device.
>>>>    * @mac_address: mac address of interface associated with this
>>>> vdpa device
>>>>    * @mac_configured: true after MAC address is configured
>>>>    * @cfg_cb: callback for config change
>>>> @@ -86,6 +137,7 @@ struct ef100_vdpa_nic {
>>>>          u64 features;
>>>>          u32 max_queue_pairs;
>>>>          struct virtio_net_config net_config;
>>>> +       struct ef100_vdpa_vring_info
>>>> vring[EF100_VDPA_MAX_QUEUES_PAIRS * 2];
>>>>          u8 *mac_address;
>>>>          bool mac_configured;
>>>>          struct vdpa_callback cfg_cb;
>>>> @@ -95,6 +147,8 @@ int ef100_vdpa_init(struct efx_probe_data
>>>> *probe_data);
>>>>   void ef100_vdpa_fini(struct efx_probe_data *probe_data);
>>>>   int ef100_vdpa_register_mgmtdev(struct efx_nic *efx);
>>>>   void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
>>>> +void ef100_vdpa_irq_vectors_free(void *data);
>>>> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>>>>
>>>>   static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic
>>>> *vdpa_nic)
>>>>   {
>>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>> b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>> index a2364ef9f492..0051c4c0e47c 100644
>>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>> @@ -9,13 +9,270 @@
>>>>
>>>>   #include <linux/vdpa.h>
>>>>   #include "ef100_vdpa.h"
>>>> +#include "io.h"
>>>>   #include "mcdi_vdpa.h"
>>>>
>>>> +/* Get the queue's function-local index of the associated VI
>>>> + * virtqueue number queue 0 is reserved for MCDI
>>>> + */
>>>> +#define EFX_GET_VI_INDEX(vq_num) (((vq_num) / 2) + 1)
>>>> +
>>>>   static struct ef100_vdpa_nic *get_vdpa_nic(struct vdpa_device *vdev)
>>>>   {
>>>>          return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
>>>>   }
>>>>
>>>> +void ef100_vdpa_irq_vectors_free(void *data)
>>>> +{
>>>> +       pci_free_irq_vectors(data);
>>>> +}
>>>> +
>>>> +static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>> +{
>>>> +       struct efx_vring_ctx *vring_ctx;
>>>> +       u32 vi_index;
>>>> +
>>>> +       if (idx % 2) /* Even VQ for RX and odd for TX */
>>>> +               vdpa_nic->vring[idx].vring_type =
>>>> EF100_VDPA_VQ_TYPE_NET_TXQ;
>>>> +       else
>>>> +               vdpa_nic->vring[idx].vring_type =
>>>> EF100_VDPA_VQ_TYPE_NET_RXQ;
>>>> +       vi_index = EFX_GET_VI_INDEX(idx);
>>>> +       vring_ctx = efx_vdpa_vring_init(vdpa_nic->efx, vi_index,
>>>> + vdpa_nic->vring[idx].vring_type);
>>>> +       if (IS_ERR(vring_ctx))
>>>> +               return PTR_ERR(vring_ctx);
>>>> +
>>>> +       vdpa_nic->vring[idx].vring_ctx = vring_ctx;
>>>> +       return 0;
>>>> +}
>>>> +
>>>> +static void delete_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16
>>>> idx)
>>>> +{
>>>> + efx_vdpa_vring_fini(vdpa_nic->vring[idx].vring_ctx);
>>>> +       vdpa_nic->vring[idx].vring_ctx = NULL;
>>>> +}
>>>> +
>>>> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>> +{
>>>> +       vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>>>> +       vdpa_nic->vring[idx].vring_state = 0;
>>>> +       vdpa_nic->vring[idx].last_avail_idx = 0;
>>>> +       vdpa_nic->vring[idx].last_used_idx = 0;
>>>> +}
>>>> +
>>>> +int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>> +{
>>>> +       u32 offset;
>>>> +       int rc;
>>>> +
>>>> +       vdpa_nic->vring[idx].irq = -EINVAL;
>>>> +       rc = create_vring_ctx(vdpa_nic, idx);
>>>> +       if (rc) {
>>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>>> +                       "%s: create_vring_ctx failed, idx:%u,
>>>> err:%d\n",
>>>> +                       __func__, idx, rc);
>>>> +               return rc;
>>>> +       }
>>>> +
>>>> +       rc =
>>>> efx_vdpa_get_doorbell_offset(vdpa_nic->vring[idx].vring_ctx,
>>>> +                                         &offset);
>>>> +       if (rc) {
>>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>>> +                       "%s: get_doorbell failed idx:%u, err:%d\n",
>>>> +                       __func__, idx, rc);
>>>> +               goto err_get_doorbell_offset;
>>>> +       }
>>>> +       vdpa_nic->vring[idx].doorbell_offset = offset;
>>>> +       vdpa_nic->vring[idx].doorbell_offset_valid = true;
>>>> +
>>>> +       return 0;
>>>> +
>>>> +err_get_doorbell_offset:
>>>> +       delete_vring_ctx(vdpa_nic, idx);
>>>> +       return rc;
>>>> +}
>>>> +
>>>> +static bool is_qid_invalid(struct ef100_vdpa_nic *vdpa_nic, u16 idx,
>>>> +                          const char *caller)
>>>> +{
>>>> +       if (unlikely(idx >= (vdpa_nic->max_queue_pairs * 2))) {
>>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>>> +                       "%s: Invalid qid %u\n", caller, idx);
>>>> +               return true;
>>>> +       }
>>>> +       return false;
>>>> +}
>>>> +
>>>> +static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
>>>> +                                    u16 idx, u64 desc_area, u64
>>>> driver_area,
>>>> +                                    u64 device_area)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               return -EINVAL;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       vdpa_nic->vring[idx].desc = desc_area;
>>>> +       vdpa_nic->vring[idx].avail = driver_area;
>>>> +       vdpa_nic->vring[idx].used = device_area;
>>>> +       vdpa_nic->vring[idx].vring_state |=
>>>> EF100_VRING_ADDRESS_CONFIGURED;
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +       return 0;
>>>> +}
>>>> +
>>>> +static void ef100_vdpa_set_vq_num(struct vdpa_device *vdev, u16
>>>> idx, u32 num)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               return;
>>>> +
>>>> +       if (!is_power_of_2(num)) {
>>>> +               dev_err(&vdev->dev, "%s: Index:%u size:%u not power
>>>> of 2\n",
>>>> +                       __func__, idx, num);
>>>> +               return;
>>>> +       }
>>> Note that this is not a requirement for packed virtqueue.
>>>
>>> """
>>> Queue Size corresponds to the maximum number of descriptors in the
>>> virtqueue5. The Queue Size value does not have to be a power of 2.
>>> """
>> Yes, but we are using split vrings and virtio spec states "Queue Size
>> value is always a power of 2" for Split virtqueues.
>
>
> Did you mean the device can only support split virtqueue? If yes, we'd
> better document this.
Yes. Will add a code comment.
>
> But this seems not scalable consider the packed virtqueue could be
> supported in the future. It would be nice if device can fail the command
> according to the type of the virtqueue, then the driver doesn't need any
> care about this.
Isn't the device expected to expose VIRTIO_F_RING_PACKED feature bit in
case it supports packed virtqueues? And as sfc doesn't expose it, this
requirement is valid.
>
>
>>>
>>>> +       if (num > EF100_VDPA_VQ_NUM_MAX_SIZE) {
>>>> +               dev_err(&vdev->dev, "%s: Index:%u size:%u more than
>>>> max:%u\n",
>>>> +                       __func__, idx, num,
>>>> EF100_VDPA_VQ_NUM_MAX_SIZE);
>>>> +               return;
>>>> +       }
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       vdpa_nic->vring[idx].size  = num;
>>>> +       vdpa_nic->vring[idx].vring_state |=
>>>> EF100_VRING_SIZE_CONFIGURED;
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +}
>>>> +
>>>> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +       u32 idx_val;
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               return;
>>>> +
>>>> +       if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>>>> +               return;
>>> In which case could we hit this condition?
>> I've noticed this condition in regular testing with vhost-vdpa. The
>> first couple of kick_vq calls arrive when the HW queues aren't created
>> yet. .I think userspace assumes queues to be ready soon after sending
>> DRIVER_OK. However, there is a little time window between that and
>> when the HW VQs are actually ready for datapath.
>
>
> Interesting, so I think the driver need to wait until the HW VQS are
> ready before return from DRIVER_OK setting in this case. Otherwise we
> may end up with the above check (and it probably lacks some kind of
> synchronization).
This could be tricky considering the case where vq creation depends on
both - device status set to DRIVER_OK and queue being enabled (the
requirement for VM LM). Accordingly, I think it's ok to ignore the vq
kick when queue doesn't exist as we are triggering a spurious vq kick
soon after creation.
>
>
>>>
>>>> +
>>>> +       idx_val = idx;
>>>> +       _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>>>> + vdpa_nic->vring[idx].doorbell_offset);
>>>> +}
>>>> +
>>>> +static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
>>>> +                                struct vdpa_callback *cb)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               return;
>>>> +
>>>> +       if (cb)
>>>> +               vdpa_nic->vring[idx].cb = *cb;
>>>> +}
>>>> +
>>>> +static void ef100_vdpa_set_vq_ready(struct vdpa_device *vdev, u16
>>>> idx,
>>>> +                                   bool ready)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               return;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       if (ready) {
>>>> +               vdpa_nic->vring[idx].vring_state |=
>>>> + EF100_VRING_READY_CONFIGURED;
>>> I think it would be sufficient to have EF100_VRING_READY_CONFIGURED
>>> here. With this set, the device can think the vq configuration is done
>>> by the driver.
>>>
>>> Or is there anything special for size and num?
>> The virtqueue is considered ready for datapath when it is fully
>> configured (both size and address set and enabled with set_vq_ready).
>> Depending on merely the queue enable (EF100_VRING_READY_CONFIGURED)
>> would assume valid values for vq size and addresses, which we wish to
>> avoid.
>
>
> Ok, but I'd say it's better to offload those to the device. According to
> the spec, once queue_enable is set, the device assumes the virtqueue
> configuration is ready (no matter if size and num are configured). And
> driver risks its own for wrong configuration and device should be ready
> for invalid configuration (this is even the case with the above codes,
> device should still need to care about illegal size and num).

I can validate the device behavior with invalid size and num but do you
see any issue with this validation specially because it can prevent
device malfunction as it can be triggered from the userspace?

Gautam

>
> Thanks
>
>
>>>
>>> Thanks
>>>
>>>
>>>> +       } else {
>>>> +               vdpa_nic->vring[idx].vring_state &=
>>>> + ~EF100_VRING_READY_CONFIGURED;
>>>> +       }
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +}
>>>> +
>>>> +static bool ef100_vdpa_get_vq_ready(struct vdpa_device *vdev, u16
>>>> idx)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +       bool ready;
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               return false;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       ready = vdpa_nic->vring[idx].vring_state &
>>>> EF100_VRING_READY_CONFIGURED;
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +       return ready;
>>>> +}
>>>> +
>>>> +static int ef100_vdpa_set_vq_state(struct vdpa_device *vdev, u16 idx,
>>>> +                                  const struct vdpa_vq_state *state)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               return -EINVAL;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       vdpa_nic->vring[idx].last_avail_idx =
>>>> state->split.avail_index;
>>>> +       vdpa_nic->vring[idx].last_used_idx = state->split.avail_index;
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +       return 0;
>>>> +}
>>>> +
>>>> +static int ef100_vdpa_get_vq_state(struct vdpa_device *vdev,
>>>> +                                  u16 idx, struct vdpa_vq_state
>>>> *state)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               return -EINVAL;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       state->split.avail_index =
>>>> (u16)vdpa_nic->vring[idx].last_used_idx;
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +
>>>> +       return 0;
>>>> +}
>>>> +
>>>> +static struct vdpa_notification_area
>>>> +               ef100_vdpa_get_vq_notification(struct vdpa_device
>>>> *vdev,
>>>> +                                              u16 idx)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +       struct vdpa_notification_area notify_area = {0, 0};
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               goto end;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       notify_area.addr = (uintptr_t)(vdpa_nic->efx->membase_phys +
>>>> + vdpa_nic->vring[idx].doorbell_offset);
>>>> +       /* VDPA doorbells are at a stride of VI/2
>>>> +        * One VI stride is shared by both rx & tx doorbells
>>>> +        */
>>>> +       notify_area.size = vdpa_nic->efx->vi_stride / 2;
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +
>>>> +end:
>>>> +       return notify_area;
>>>> +}
>>>> +
>>>> +static int ef100_get_vq_irq(struct vdpa_device *vdev, u16 idx)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +       u32 irq;
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               return -EINVAL;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       irq = vdpa_nic->vring[idx].irq;
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +
>>>> +       return irq;
>>>> +}
>>>> +
>>>>   static u32 ef100_vdpa_get_vq_align(struct vdpa_device *vdev)
>>>>   {
>>>>          return EF100_VDPA_VQ_ALIGN;
>>>> @@ -80,6 +337,8 @@ static void ef100_vdpa_set_config_cb(struct
>>>> vdpa_device *vdev,
>>>>
>>>>          if (cb)
>>>>                  vdpa_nic->cfg_cb = *cb;
>>>> +       else
>>>> +               memset(&vdpa_nic->cfg_cb, 0,
>>>> sizeof(vdpa_nic->cfg_cb));
>>>>   }
>>>>
>>>>   static u16 ef100_vdpa_get_vq_num_max(struct vdpa_device *vdev)
>>>> @@ -137,14 +396,30 @@ static void ef100_vdpa_set_config(struct
>>>> vdpa_device *vdev, unsigned int offset,
>>>>   static void ef100_vdpa_free(struct vdpa_device *vdev)
>>>>   {
>>>>          struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +       int i;
>>>>
>>>>          if (vdpa_nic) {
>>>> +               for (i = 0; i < (vdpa_nic->max_queue_pairs * 2);
>>>> i++) {
>>>> +                       reset_vring(vdpa_nic, i);
>>>> +                       if (vdpa_nic->vring[i].vring_ctx)
>>>> +                               delete_vring_ctx(vdpa_nic, i);
>>>> +               }
>>>>                  mutex_destroy(&vdpa_nic->lock);
>>>>                  vdpa_nic->efx->vdpa_nic = NULL;
>>>>          }
>>>>   }
>>>>
>>>>   const struct vdpa_config_ops ef100_vdpa_config_ops = {
>>>> +       .set_vq_address      = ef100_vdpa_set_vq_address,
>>>> +       .set_vq_num          = ef100_vdpa_set_vq_num,
>>>> +       .kick_vq             = ef100_vdpa_kick_vq,
>>>> +       .set_vq_cb           = ef100_vdpa_set_vq_cb,
>>>> +       .set_vq_ready        = ef100_vdpa_set_vq_ready,
>>>> +       .get_vq_ready        = ef100_vdpa_get_vq_ready,
>>>> +       .set_vq_state        = ef100_vdpa_set_vq_state,
>>>> +       .get_vq_state        = ef100_vdpa_get_vq_state,
>>>> +       .get_vq_notification = ef100_vdpa_get_vq_notification,
>>>> +       .get_vq_irq          = ef100_get_vq_irq,
>>>>          .get_vq_align        = ef100_vdpa_get_vq_align,
>>>>          .get_device_features = ef100_vdpa_get_device_features,
>>>>          .set_driver_features = ef100_vdpa_set_driver_features,
>>>> --
>>>> 2.30.1
>>>>
>>
>

2023-03-15 17:19:16

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 09/14] sfc: implement device status related vdpa config operations


On 3/15/23 10:30, Jason Wang wrote:
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> 在 2023/3/13 20:10, Gautam Dawar 写道:
>>
>> On 3/10/23 10:35, Jason Wang wrote:
>>> Caution: This message originated from an External Source. Use proper
>>> caution when opening attachments, clicking links, or responding.
>>>
>>>
>>> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]>
>>> wrote:
>>>> vDPA config opertions to handle get/set device status and device
>>>> reset have been implemented. Also .suspend config operation is
>>>> implemented to support Live Migration.
>>>>
>>>> Signed-off-by: Gautam Dawar <[email protected]>
>>>> ---
>>>>   drivers/net/ethernet/sfc/ef100_vdpa.c     |  16 +-
>>>>   drivers/net/ethernet/sfc/ef100_vdpa.h     |   2 +
>>>>   drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 367
>>>> ++++++++++++++++++++--
>>>>   3 files changed, 355 insertions(+), 30 deletions(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>> b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>> index c66e5aef69ea..4ba57827a6cd 100644
>>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>> @@ -68,9 +68,14 @@ static int vdpa_allocate_vis(struct efx_nic *efx,
>>>> unsigned int *allocated_vis)
>>>>
>>>>   static void ef100_vdpa_delete(struct efx_nic *efx)
>>>>   {
>>>> +       struct vdpa_device *vdpa_dev;
>>>> +
>>>>          if (efx->vdpa_nic) {
>>>> +               vdpa_dev = &efx->vdpa_nic->vdpa_dev;
>>>> +               ef100_vdpa_reset(vdpa_dev);
>>>> +
>>>>                  /* replace with _vdpa_unregister_device later */
>>>> - put_device(&efx->vdpa_nic->vdpa_dev.dev);
>>>> +               put_device(&vdpa_dev->dev);
>>>>          }
>>>>          efx_mcdi_free_vis(efx);
>>>>   }
>>>> @@ -171,6 +176,15 @@ static struct ef100_vdpa_nic
>>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>>                  }
>>>>          }
>>>>
>>>> +       rc = devm_add_action_or_reset(&efx->pci_dev->dev,
>>>> + ef100_vdpa_irq_vectors_free,
>>>> +                                     efx->pci_dev);
>>>> +       if (rc) {
>>>> +               pci_err(efx->pci_dev,
>>>> +                       "Failed adding devres for freeing irq
>>>> vectors\n");
>>>> +               goto err_put_device;
>>>> +       }
>>>> +
>>>>          rc = get_net_config(vdpa_nic);
>>>>          if (rc)
>>>>                  goto err_put_device;
>>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> index 348ca8a7404b..58791402e454 100644
>>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> @@ -149,6 +149,8 @@ int ef100_vdpa_register_mgmtdev(struct efx_nic
>>>> *efx);
>>>>   void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
>>>>   void ef100_vdpa_irq_vectors_free(void *data);
>>>>   int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx);
>>>> +void ef100_vdpa_irq_vectors_free(void *data);
>>>> +int ef100_vdpa_reset(struct vdpa_device *vdev);
>>>>
>>>>   static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic
>>>> *vdpa_nic)
>>>>   {
>>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>> b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>> index 0051c4c0e47c..95a2177f85a2 100644
>>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>> @@ -22,11 +22,6 @@ static struct ef100_vdpa_nic *get_vdpa_nic(struct
>>>> vdpa_device *vdev)
>>>>          return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
>>>>   }
>>>>
>>>> -void ef100_vdpa_irq_vectors_free(void *data)
>>>> -{
>>>> -       pci_free_irq_vectors(data);
>>>> -}
>>>> -
>>>>   static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16
>>>> idx)
>>>>   {
>>>>          struct efx_vring_ctx *vring_ctx;
>>>> @@ -52,14 +47,6 @@ static void delete_vring_ctx(struct
>>>> ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>>          vdpa_nic->vring[idx].vring_ctx = NULL;
>>>>   }
>>>>
>>>> -static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>> -{
>>>> -       vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>>>> -       vdpa_nic->vring[idx].vring_state = 0;
>>>> -       vdpa_nic->vring[idx].last_avail_idx = 0;
>>>> -       vdpa_nic->vring[idx].last_used_idx = 0;
>>>> -}
>>>> -
>>>>   int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>>   {
>>>>          u32 offset;
>>>> @@ -103,6 +90,236 @@ static bool is_qid_invalid(struct
>>>> ef100_vdpa_nic *vdpa_nic, u16 idx,
>>>>          return false;
>>>>   }
>>>>
>>>> +static void irq_vring_fini(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>> +{
>>>> +       struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
>>>> +       struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
>>>> +
>>>> +       devm_free_irq(&pci_dev->dev, vring->irq, vring);
>>>> +       vring->irq = -EINVAL;
>>>> +}
>>>> +
>>>> +static irqreturn_t vring_intr_handler(int irq, void *arg)
>>>> +{
>>>> +       struct ef100_vdpa_vring_info *vring = arg;
>>>> +
>>>> +       if (vring->cb.callback)
>>>> +               return vring->cb.callback(vring->cb.private);
>>>> +
>>>> +       return IRQ_NONE;
>>>> +}
>>>> +
>>>> +static int ef100_vdpa_irq_vectors_alloc(struct pci_dev *pci_dev,
>>>> u16 nvqs)
>>>> +{
>>>> +       int rc;
>>>> +
>>>> +       rc = pci_alloc_irq_vectors(pci_dev, nvqs, nvqs, PCI_IRQ_MSIX);
>>>> +       if (rc < 0)
>>>> +               pci_err(pci_dev,
>>>> +                       "Failed to alloc %d IRQ vectors, err:%d\n",
>>>> nvqs, rc);
>>>> +       return rc;
>>>> +}
>>>> +
>>>> +void ef100_vdpa_irq_vectors_free(void *data)
>>>> +{
>>>> +       pci_free_irq_vectors(data);
>>>> +}
>>>> +
>>>> +static int irq_vring_init(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>> +{
>>>> +       struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
>>>> +       struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
>>>> +       int irq;
>>>> +       int rc;
>>>> +
>>>> +       snprintf(vring->msix_name, 256, "x_vdpa[%s]-%d\n",
>>>> +                pci_name(pci_dev), idx);
>>>> +       irq = pci_irq_vector(pci_dev, idx);
>>>> +       rc = devm_request_irq(&pci_dev->dev, irq,
>>>> vring_intr_handler, 0,
>>>> +                             vring->msix_name, vring);
>>>> +       if (rc)
>>>> +               pci_err(pci_dev,
>>>> +                       "devm_request_irq failed for vring %d, rc
>>>> %d\n",
>>>> +                       idx, rc);
>>>> +       else
>>>> +               vring->irq = irq;
>>>> +
>>>> +       return rc;
>>>> +}
>>>> +
>>>> +static int delete_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>> +{
>>>> +       struct efx_vring_dyn_cfg vring_dyn_cfg;
>>>> +       int rc;
>>>> +
>>>> +       if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>>>> +               return 0;
>>>> +
>>>> +       rc = efx_vdpa_vring_destroy(vdpa_nic->vring[idx].vring_ctx,
>>>> +                                   &vring_dyn_cfg);
>>>> +       if (rc)
>>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>>> +                       "%s: delete vring failed index:%u, err:%d\n",
>>>> +                       __func__, idx, rc);
>>>> +       vdpa_nic->vring[idx].last_avail_idx = vring_dyn_cfg.avail_idx;
>>>> +       vdpa_nic->vring[idx].last_used_idx = vring_dyn_cfg.used_idx;
>>>> +       vdpa_nic->vring[idx].vring_state &= ~EF100_VRING_CREATED;
>>>> +
>>>> +       irq_vring_fini(vdpa_nic, idx);
>>>> +
>>>> +       return rc;
>>>> +}
>>>> +
>>>> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +       u32 idx_val;
>>>> +
>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> +               return;
>>>> +
>>>> +       if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>>>> +               return;
>>>> +
>>>> +       idx_val = idx;
>>>> +       _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>>>> + vdpa_nic->vring[idx].doorbell_offset);
>>>> +}
>>>> +
>>>> +static bool can_create_vring(struct ef100_vdpa_nic *vdpa_nic, u16
>>>> idx)
>>>> +{
>>>> +       if (vdpa_nic->vring[idx].vring_state ==
>>>> EF100_VRING_CONFIGURED &&
>>>> +           vdpa_nic->status & VIRTIO_CONFIG_S_DRIVER_OK &&
>>>> +           !(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>>>> +               return true;
>>>> +
>>>> +       return false;
>>>> +}
>>>> +
>>>> +static int create_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>> +{
>>>> +       struct efx_vring_dyn_cfg vring_dyn_cfg;
>>>> +       struct efx_vring_cfg vring_cfg;
>>>> +       int rc;
>>>> +
>>>> +       rc = irq_vring_init(vdpa_nic, idx);
>>>> +       if (rc) {
>>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>>> +                       "%s: irq_vring_init failed. index:%u,
>>>> err:%d\n",
>>>> +                       __func__, idx, rc);
>>>> +               return rc;
>>>> +       }
>>>> +       vring_cfg.desc = vdpa_nic->vring[idx].desc;
>>>> +       vring_cfg.avail = vdpa_nic->vring[idx].avail;
>>>> +       vring_cfg.used = vdpa_nic->vring[idx].used;
>>>> +       vring_cfg.size = vdpa_nic->vring[idx].size;
>>>> +       vring_cfg.features = vdpa_nic->features;
>>>> +       vring_cfg.msix_vector = idx;
>>>> +       vring_dyn_cfg.avail_idx = vdpa_nic->vring[idx].last_avail_idx;
>>>> +       vring_dyn_cfg.used_idx = vdpa_nic->vring[idx].last_used_idx;
>>>> +
>>>> +       rc = efx_vdpa_vring_create(vdpa_nic->vring[idx].vring_ctx,
>>>> +                                  &vring_cfg, &vring_dyn_cfg);
>>>> +       if (rc) {
>>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>>> +                       "%s: vring_create failed index:%u, err:%d\n",
>>>> +                       __func__, idx, rc);
>>>> +               goto err_vring_create;
>>>> +       }
>>>> +       vdpa_nic->vring[idx].vring_state |= EF100_VRING_CREATED;
>>>> +
>>>> +       /* A VQ kick allows the device to read the avail_idx, which
>>>> will be
>>>> +        * required at the destination after live migration.
>>>> +        */
>>>> +       ef100_vdpa_kick_vq(&vdpa_nic->vdpa_dev, idx);
>>>> +
>>>> +       return 0;
>>>> +
>>>> +err_vring_create:
>>>> +       irq_vring_fini(vdpa_nic, idx);
>>>> +       return rc;
>>>> +}
>>>> +
>>>> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>> +{
>>>> +       delete_vring(vdpa_nic, idx);
>>>> +       vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>>>> +       vdpa_nic->vring[idx].vring_state = 0;
>>>> +       vdpa_nic->vring[idx].last_avail_idx = 0;
>>>> +       vdpa_nic->vring[idx].last_used_idx = 0;
>>>> +}
>>>> +
>>>> +static void ef100_reset_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>>>> +{
>>>> +       int i;
>>>> +
>>>> +       WARN_ON(!mutex_is_locked(&vdpa_nic->lock));
>>>> +
>>>> +       if (!vdpa_nic->status)
>>>> +               return;
>>>> +
>>>> +       vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
>>>> +       vdpa_nic->status = 0;
>>>> +       vdpa_nic->features = 0;
>>>> +       for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++)
>>>> +               reset_vring(vdpa_nic, i);
>>>> + ef100_vdpa_irq_vectors_free(vdpa_nic->efx->pci_dev);
>>>> +}
>>>> +
>>>> +/* May be called under the rtnl lock */
>>>> +int ef100_vdpa_reset(struct vdpa_device *vdev)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +
>>>> +       /* vdpa device can be deleted anytime but the bar_config
>>>> +        * could still be vdpa and hence efx->state would be
>>>> STATE_VDPA.
>>>> +        * Accordingly, ensure vdpa device exists before reset
>>>> handling
>>>> +        */
>>>> +       if (!vdpa_nic)
>>>> +               return -ENODEV;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       ef100_reset_vdpa_device(vdpa_nic);
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +       return 0;
>>>> +}
>>>> +
>>>> +static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>>>> +{
>>>> +       struct efx_nic *efx = vdpa_nic->efx;
>>>> +       struct ef100_nic_data *nic_data;
>>>> +       int i, j;
>>>> +       int rc;
>>>> +
>>>> +       nic_data = efx->nic_data;
>>>> +       rc = ef100_vdpa_irq_vectors_alloc(efx->pci_dev,
>>>> + vdpa_nic->max_queue_pairs * 2);
>>>> +       if (rc < 0) {
>>>> +               pci_err(efx->pci_dev,
>>>> +                       "vDPA IRQ alloc failed for vf: %u err:%d\n",
>>>> +                       nic_data->vf_index, rc);
>>>> +               return rc;
>>>> +       }
>>>> +
>>>> +       for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>>>> +               if (can_create_vring(vdpa_nic, i)) {
>>>> +                       rc = create_vring(vdpa_nic, i);
>>>> +                       if (rc)
>>>> +                               goto clear_vring;
>>>> +               }
>>>> +       }
>>>> +
>>>> +       vdpa_nic->vdpa_state = EF100_VDPA_STATE_STARTED;
>>> It looks to me that this duplicates with the DRIVER_OK status bit.
>> vdpa_state is set EF100_VDPA_STATE_STARTED during DRIVER_OK handling.
>> See my later response for its purpose.
>>>
>>>> +       return 0;
>>>> +
>>>> +clear_vring:
>>>> +       for (j = 0; j < i; j++)
>>>> +               delete_vring(vdpa_nic, j);
>>>> +
>>>> +       ef100_vdpa_irq_vectors_free(efx->pci_dev);
>>>> +       return rc;
>>>> +}
>>>> +
>>>>   static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
>>>>                                       u16 idx, u64 desc_area, u64
>>>> driver_area,
>>>>                                       u64 device_area)
>>>> @@ -144,22 +361,6 @@ static void ef100_vdpa_set_vq_num(struct
>>>> vdpa_device *vdev, u16 idx, u32 num)
>>>>          mutex_unlock(&vdpa_nic->lock);
>>>>   }
>>>>
>>>> -static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>>>> -{
>>>> -       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> -       u32 idx_val;
>>>> -
>>>> -       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>> -               return;
>>>> -
>>>> -       if (!(vdpa_nic->vring[idx].vring_state & EF100_VRING_CREATED))
>>>> -               return;
>>>> -
>>>> -       idx_val = idx;
>>>> -       _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>>>> - vdpa_nic->vring[idx].doorbell_offset);
>>>> -}
>>>> -
>>>>   static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
>>>>                                   struct vdpa_callback *cb)
>>>>   {
>>>> @@ -176,6 +377,7 @@ static void ef100_vdpa_set_vq_ready(struct
>>>> vdpa_device *vdev, u16 idx,
>>>>                                      bool ready)
>>>>   {
>>>>          struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +       int rc;
>>>>
>>>>          if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>>                  return;
>>>> @@ -184,9 +386,21 @@ static void ef100_vdpa_set_vq_ready(struct
>>>> vdpa_device *vdev, u16 idx,
>>>>          if (ready) {
>>>>                  vdpa_nic->vring[idx].vring_state |=
>>>> EF100_VRING_READY_CONFIGURED;
>>>> +               if (vdpa_nic->vdpa_state ==
>>>> EF100_VDPA_STATE_STARTED &&
>>>> +                   can_create_vring(vdpa_nic, idx)) {
>>>> +                       rc = create_vring(vdpa_nic, idx);
>>>> +                       if (rc)
>>>> +                               /* Rollback ready configuration
>>>> +                                * So that the above layer driver
>>>> +                                * can make another attempt to set
>>>> ready
>>>> +                                */
>>>> + vdpa_nic->vring[idx].vring_state &=
>>>> + ~EF100_VRING_READY_CONFIGURED;
>>>> +               }
>>>>          } else {
>>>>                  vdpa_nic->vring[idx].vring_state &=
>>>> ~EF100_VRING_READY_CONFIGURED;
>>>> +               delete_vring(vdpa_nic, idx);
>>>>          }
>>>>          mutex_unlock(&vdpa_nic->lock);
>>>>   }
>>>> @@ -296,6 +510,12 @@ static u64
>>>> ef100_vdpa_get_device_features(struct vdpa_device *vdev)
>>>>          }
>>>>
>>>>          features |= BIT_ULL(VIRTIO_NET_F_MAC);
>>>> +       /* As QEMU SVQ doesn't implement the following features,
>>>> +        * masking them off to allow Live Migration
>>>> +        */
>>>> +       features &= ~BIT_ULL(VIRTIO_F_IN_ORDER);
>>>> +       features &= ~BIT_ULL(VIRTIO_F_ORDER_PLATFORM);
>>> It's better not to work around userspace bugs in the kernel. We should
>>> fix Qemu instead.
>>
>> There's already a QEMU patch [1] submitted to support
>> VIRTIO_F_ORDER_PLATFORM but it hasn't concluded yet. Also, there is no
>> support for VIRTIO_F_IN_ORDER in the kernel virtio driver. The motive
>> of this change is to have VM Live Migration working with the kernel
>> in-tree driver without requiring any changes.
>>
>> Once QEMU is able to handle these features, we can submit a patch to
>> undo these changes.
>
>
> I can understand the motivation, but it works for prototyping but not
> formal kernel code (especially consider SVQ is not mature and still
> being development). What's more, we can not assume Qemu is the only
> user, we have other users like DPDK and cloud-hypervisors.

Ok, if the expectation is to have the user deal with the issues and make
required changes on the in-tree driver to make it work, I'll remove this
part.

>
> Thanks
>
>
>>
>>>
>>>> +
>>>>          return features;
>>>>   }
>>>>
>>>> @@ -356,6 +576,77 @@ static u32 ef100_vdpa_get_vendor_id(struct
>>>> vdpa_device *vdev)
>>>>          return EF100_VDPA_VENDOR_ID;
>>>>   }
>>>>
>>>> +static u8 ef100_vdpa_get_status(struct vdpa_device *vdev)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +       u8 status;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       status = vdpa_nic->status;
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +       return status;
>>>> +}
>>>> +
>>>> +static void ef100_vdpa_set_status(struct vdpa_device *vdev, u8
>>>> status)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +       u8 new_status;
>>>> +       int rc;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       if (!status) {
>>>> +               dev_info(&vdev->dev,
>>>> +                        "%s: Status received is 0. Device reset
>>>> being done\n",
>>>> +                        __func__);
>>> This is trigger-able by the userspace. It might be better to use
>>> dev_dbg() instead.
>> Will change.
>>>
>>>> + ef100_reset_vdpa_device(vdpa_nic);
>>>> +               goto unlock_return;
>>>> +       }
>>>> +       new_status = status & ~vdpa_nic->status;
>>>> +       if (new_status == 0) {
>>>> +               dev_info(&vdev->dev,
>>>> +                        "%s: New status same as current status\n",
>>>> __func__);
>>> Same here.
>> Ok.
>>>
>>>> +               goto unlock_return;
>>>> +       }
>>>> +       if (new_status & VIRTIO_CONFIG_S_FAILED) {
>>>> +               ef100_reset_vdpa_device(vdpa_nic);
>>>> +               goto unlock_return;
>>>> +       }
>>>> +
>>>> +       if (new_status & VIRTIO_CONFIG_S_ACKNOWLEDGE) {
>>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_ACKNOWLEDGE;
>>>> +               new_status &= ~VIRTIO_CONFIG_S_ACKNOWLEDGE;
>>>> +       }
>>>> +       if (new_status & VIRTIO_CONFIG_S_DRIVER) {
>>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER;
>>>> +               new_status &= ~VIRTIO_CONFIG_S_DRIVER;
>>>> +       }
>>>> +       if (new_status & VIRTIO_CONFIG_S_FEATURES_OK) {
>>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_FEATURES_OK;
>>>> +               vdpa_nic->vdpa_state = EF100_VDPA_STATE_NEGOTIATED;
>>> It might be better to explain the reason we need to track another
>>> state in vdpa_state instead of simply using the device status.
>> vdpa_state helps to ensure correct status transitions in the
>> .set_status callback and safe-guards against incorrect/malicious
>> user-space driver.
>
>
> Ok, let's document this in the definition of vdpa_state.
Sure, will do.
>
>
>>>
>>>> +               new_status &= ~VIRTIO_CONFIG_S_FEATURES_OK;
>>>> +       }
>>>> +       if (new_status & VIRTIO_CONFIG_S_DRIVER_OK &&
>>>> +           vdpa_nic->vdpa_state == EF100_VDPA_STATE_NEGOTIATED) {
>>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER_OK;
>>>> +               rc = start_vdpa_device(vdpa_nic);
>>>> +               if (rc) {
>>>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>>>> +                               "%s: vDPA device failed:%d\n",
>>>> __func__, rc);
>>>> +                       vdpa_nic->status &=
>>>> ~VIRTIO_CONFIG_S_DRIVER_OK;
>>>> +                       goto unlock_return;
>>>> +               }
>>>> +               new_status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
>>>> +       }
>>>> +       if (new_status) {
>>>> +               dev_warn(&vdev->dev,
>>>> +                        "%s: Mismatch Status: %x & State: %u\n",
>>>> +                        __func__, new_status, vdpa_nic->vdpa_state);
>>>> +       }
>>>> +
>>>> +unlock_return:
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +}
>>>> +
>>>>   static size_t ef100_vdpa_get_config_size(struct vdpa_device *vdev)
>>>>   {
>>>>          return sizeof(struct virtio_net_config);
>>>> @@ -393,6 +684,20 @@ static void ef100_vdpa_set_config(struct
>>>> vdpa_device *vdev, unsigned int offset,
>>>>                  vdpa_nic->mac_configured = true;
>>>>   }
>>>>
>>>> +static int ef100_vdpa_suspend(struct vdpa_device *vdev)
>>>> +{
>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> +       int i, rc;
>>>> +
>>>> +       mutex_lock(&vdpa_nic->lock);
>>>> +       for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>>>> +               rc = delete_vring(vdpa_nic, i);
>>> Note that the suspension matters for the whole device. It means the
>>> config space should not be changed. But the code here only suspends
>>> the vring, is this intende/d?
>> Are you referring to the possibility of updating device configuration
>> (eg. MAC address) using .set_config() after suspend operation? Is
>> there any other user triggered operation that falls in this category?
>
>
> Updating MAC should be prohibited, one typical use case is the link
> status.
I think this can be dealt with an additional SUSPEND state which can be
used to avoid any changes to the config space.
>
>
>>>
>>> Reset may have the same issue.
>> Could you pls elaborate on the requirement during device reset?
>
>
> I meant ef100_reset_vdpa_device() may suffer from the same issue:
>
> It only reset all the vring but not the config space?

Ok, I think resetting config space would basically be clearing the
memory for vdpa_nic->net_config which is the initial state after vdpa
device allocation.

Gautam

>
> Thanks
>
>
>>>
>>> Thanks
>> [1]
>> https://patchew.org/QEMU/[email protected]/
>>>
>>>> +               if (rc)
>>>> +                       break;
>>>> +       }
>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>> +       return rc;
>>>> +}
>>>>   static void ef100_vdpa_free(struct vdpa_device *vdev)
>>>>   {
>>>>          struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>> @@ -428,9 +733,13 @@ const struct vdpa_config_ops
>>>> ef100_vdpa_config_ops = {
>>>>          .get_vq_num_max      = ef100_vdpa_get_vq_num_max,
>>>>          .get_device_id       = ef100_vdpa_get_device_id,
>>>>          .get_vendor_id       = ef100_vdpa_get_vendor_id,
>>>> +       .get_status          = ef100_vdpa_get_status,
>>>> +       .set_status          = ef100_vdpa_set_status,
>>>> +       .reset               = ef100_vdpa_reset,
>>>>          .get_config_size     = ef100_vdpa_get_config_size,
>>>>          .get_config          = ef100_vdpa_get_config,
>>>>          .set_config          = ef100_vdpa_set_config,
>>>>          .get_generation      = NULL,
>>>> +       .suspend             = ef100_vdpa_suspend,
>>>>          .free                = ef100_vdpa_free,
>>>>   };
>>>> --
>>>> 2.30.1
>>>>
>>
>

2023-03-16 09:07:11

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 01/14] sfc: add function personality support for EF100 devices

On Wed, Mar 15, 2023 at 01:11:23PM +0800, Jason Wang wrote:
>
> 在 2023/3/13 19:50, Martin Habets 写道:
> > On Fri, Mar 10, 2023 at 01:04:14PM +0800, Jason Wang wrote:
> > > On Tue, Mar 7, 2023 at 7:36 PM Gautam Dawar <[email protected]> wrote:
> > > > A function personality defines the location and semantics of
> > > > registers in the BAR. EF100 NICs allow different personalities
> > > > of a PCIe function and changing it at run-time. A total of three
> > > > function personalities are defined as of now: EF100, vDPA and
> > > > None with EF100 being the default.
> > > > For now, vDPA net devices can be created on a EF100 virtual
> > > > function and the VF personality will be changed to vDPA in the
> > > > process.
> > > >
> > > > Co-developed-by: Martin Habets <[email protected]>
> > > > Signed-off-by: Martin Habets <[email protected]>
> > > > Signed-off-by: Gautam Dawar <[email protected]>
> > > > ---
> > > > drivers/net/ethernet/sfc/ef100.c | 6 +-
> > > > drivers/net/ethernet/sfc/ef100_nic.c | 98 +++++++++++++++++++++++++++-
> > > > drivers/net/ethernet/sfc/ef100_nic.h | 11 ++++
> > > > 3 files changed, 111 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
> > > > index 71aab3d0480f..c1c69783db7b 100644
> > > > --- a/drivers/net/ethernet/sfc/ef100.c
> > > > +++ b/drivers/net/ethernet/sfc/ef100.c
> > > > @@ -429,8 +429,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
> > > > if (!efx)
> > > > return;
> > > >
> > > > - probe_data = container_of(efx, struct efx_probe_data, efx);
> > > > - ef100_remove_netdev(probe_data);
> > > > + efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_NONE);
> > > > #ifdef CONFIG_SFC_SRIOV
> > > > efx_fini_struct_tc(efx);
> > > > #endif
> > > > @@ -443,6 +442,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
> > > > pci_disable_pcie_error_reporting(pci_dev);
> > > >
> > > > pci_set_drvdata(pci_dev, NULL);
> > > > + probe_data = container_of(efx, struct efx_probe_data, efx);
> > > > efx_fini_struct(efx);
> > > > kfree(probe_data);
> > > > };
> > > > @@ -508,7 +508,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
> > > > goto fail;
> > > >
> > > > efx->state = STATE_PROBED;
> > > > - rc = ef100_probe_netdev(probe_data);
> > > > + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
> > > > if (rc)
> > > > goto fail;
> > > >
> > > > diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> > > > index 4dc643b0d2db..8cbe5e0f4bdf 100644
> > > > --- a/drivers/net/ethernet/sfc/ef100_nic.c
> > > > +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> > > > @@ -772,6 +772,99 @@ static int efx_ef100_get_base_mport(struct efx_nic *efx)
> > > > return 0;
> > > > }
> > > >
> > > > +/* BAR configuration.
> > > > + * To change BAR configuration, tear down the current configuration (which
> > > > + * leaves the hardware in the PROBED state), and then initialise the new
> > > > + * BAR state.
> > > > + */
> > > > +struct ef100_bar_config_ops {
> > > > + int (*init)(struct efx_probe_data *probe_data);
> > > > + void (*fini)(struct efx_probe_data *probe_data);
> > > > +};
> > > > +
> > > > +static const struct ef100_bar_config_ops bar_config_ops[] = {
> > > > + [EF100_BAR_CONFIG_EF100] = {
> > > > + .init = ef100_probe_netdev,
> > > > + .fini = ef100_remove_netdev
> > > > + },
> > > > +#ifdef CONFIG_SFC_VDPA
> > > > + [EF100_BAR_CONFIG_VDPA] = {
> > > > + .init = NULL,
> > > > + .fini = NULL
> > > > + },
> > > > +#endif
> > > > + [EF100_BAR_CONFIG_NONE] = {
> > > > + .init = NULL,
> > > > + .fini = NULL
> > > > + },
> > > > +};
> > > This looks more like a mini bus implementation. I wonder if we can
> > > reuse an auxiliary bus here which is more user friendly for management
> > > tools.
> > When we were in the design phase of vDPA for EF100 it was still called
> > virtbus, and the virtbus discussion was in full swing at that time.
> > We could not afford to add risk to the project by depending on it, as
> > it might not have been merged at all.
>
>
> Right.
>
>
> > If we were doing the same design now I would definitely consider using
> > the auxiliary bus.
> >
> > Martin
>
>
> But it's not late to do the change now. Auxiliary bus has been used by a lot
> of devices (even with vDPA device). The change looks not too complicated.

I'm surprised you think this would not be complicated. From my view it would
require redesign, redevelopment and retest of vdpa which would take months. That is
assuming we can get some of the resources back.

> This looks more scalable and convenient for management layer.

There is not much difference for the management layer, it uses the vdpa tool now
and it would do so with the auxiliary bus. The difference is that with the
auxiliary bus users would have to load another module for sfc vDPA support.
Are we maybe on 2 different trains of thought here?

Martin

2023-03-17 03:53:02

by Jason Wang

[permalink] [raw]
Subject: Re: [PATCH net-next v2 01/14] sfc: add function personality support for EF100 devices

On Thu, Mar 16, 2023 at 5:07 PM Martin Habets <[email protected]> wrote:
>
> On Wed, Mar 15, 2023 at 01:11:23PM +0800, Jason Wang wrote:
> >
> > 在 2023/3/13 19:50, Martin Habets 写道:
> > > On Fri, Mar 10, 2023 at 01:04:14PM +0800, Jason Wang wrote:
> > > > On Tue, Mar 7, 2023 at 7:36 PM Gautam Dawar <[email protected]> wrote:
> > > > > A function personality defines the location and semantics of
> > > > > registers in the BAR. EF100 NICs allow different personalities
> > > > > of a PCIe function and changing it at run-time. A total of three
> > > > > function personalities are defined as of now: EF100, vDPA and
> > > > > None with EF100 being the default.
> > > > > For now, vDPA net devices can be created on a EF100 virtual
> > > > > function and the VF personality will be changed to vDPA in the
> > > > > process.
> > > > >
> > > > > Co-developed-by: Martin Habets <[email protected]>
> > > > > Signed-off-by: Martin Habets <[email protected]>
> > > > > Signed-off-by: Gautam Dawar <[email protected]>
> > > > > ---
> > > > > drivers/net/ethernet/sfc/ef100.c | 6 +-
> > > > > drivers/net/ethernet/sfc/ef100_nic.c | 98 +++++++++++++++++++++++++++-
> > > > > drivers/net/ethernet/sfc/ef100_nic.h | 11 ++++
> > > > > 3 files changed, 111 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
> > > > > index 71aab3d0480f..c1c69783db7b 100644
> > > > > --- a/drivers/net/ethernet/sfc/ef100.c
> > > > > +++ b/drivers/net/ethernet/sfc/ef100.c
> > > > > @@ -429,8 +429,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
> > > > > if (!efx)
> > > > > return;
> > > > >
> > > > > - probe_data = container_of(efx, struct efx_probe_data, efx);
> > > > > - ef100_remove_netdev(probe_data);
> > > > > + efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_NONE);
> > > > > #ifdef CONFIG_SFC_SRIOV
> > > > > efx_fini_struct_tc(efx);
> > > > > #endif
> > > > > @@ -443,6 +442,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
> > > > > pci_disable_pcie_error_reporting(pci_dev);
> > > > >
> > > > > pci_set_drvdata(pci_dev, NULL);
> > > > > + probe_data = container_of(efx, struct efx_probe_data, efx);
> > > > > efx_fini_struct(efx);
> > > > > kfree(probe_data);
> > > > > };
> > > > > @@ -508,7 +508,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
> > > > > goto fail;
> > > > >
> > > > > efx->state = STATE_PROBED;
> > > > > - rc = ef100_probe_netdev(probe_data);
> > > > > + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
> > > > > if (rc)
> > > > > goto fail;
> > > > >
> > > > > diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> > > > > index 4dc643b0d2db..8cbe5e0f4bdf 100644
> > > > > --- a/drivers/net/ethernet/sfc/ef100_nic.c
> > > > > +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> > > > > @@ -772,6 +772,99 @@ static int efx_ef100_get_base_mport(struct efx_nic *efx)
> > > > > return 0;
> > > > > }
> > > > >
> > > > > +/* BAR configuration.
> > > > > + * To change BAR configuration, tear down the current configuration (which
> > > > > + * leaves the hardware in the PROBED state), and then initialise the new
> > > > > + * BAR state.
> > > > > + */
> > > > > +struct ef100_bar_config_ops {
> > > > > + int (*init)(struct efx_probe_data *probe_data);
> > > > > + void (*fini)(struct efx_probe_data *probe_data);
> > > > > +};
> > > > > +
> > > > > +static const struct ef100_bar_config_ops bar_config_ops[] = {
> > > > > + [EF100_BAR_CONFIG_EF100] = {
> > > > > + .init = ef100_probe_netdev,
> > > > > + .fini = ef100_remove_netdev
> > > > > + },
> > > > > +#ifdef CONFIG_SFC_VDPA
> > > > > + [EF100_BAR_CONFIG_VDPA] = {
> > > > > + .init = NULL,
> > > > > + .fini = NULL
> > > > > + },
> > > > > +#endif
> > > > > + [EF100_BAR_CONFIG_NONE] = {
> > > > > + .init = NULL,
> > > > > + .fini = NULL
> > > > > + },
> > > > > +};
> > > > This looks more like a mini bus implementation. I wonder if we can
> > > > reuse an auxiliary bus here which is more user friendly for management
> > > > tools.
> > > When we were in the design phase of vDPA for EF100 it was still called
> > > virtbus, and the virtbus discussion was in full swing at that time.
> > > We could not afford to add risk to the project by depending on it, as
> > > it might not have been merged at all.
> >
> >
> > Right.
> >
> >
> > > If we were doing the same design now I would definitely consider using
> > > the auxiliary bus.
> > >
> > > Martin
> >
> >
> > But it's not late to do the change now. Auxiliary bus has been used by a lot
> > of devices (even with vDPA device). The change looks not too complicated.
>
> I'm surprised you think this would not be complicated. From my view it would
> require redesign, redevelopment and retest of vdpa which would take months. That is
> assuming we can get some of the resources back.

I think I'm fine if we agree to do it sometime in the future.

>
> > This looks more scalable and convenient for management layer.
>
> There is not much difference for the management layer, it uses the vdpa tool now
> and it would do so with the auxiliary bus.

At the vDPA level it doesn't make too much difference.

> The difference is that with the
> auxiliary bus users would have to load another module for sfc vDPA support.

The policy is fully under the control of the management instead of the
hard-coding policy now, more below.

> Are we maybe on 2 different trains of thought here?

If I read the code correct, when VF is probed:

1) vDPA mgmtdev is registered
2) netdev is probed, bar config set to netdev

This means when user want to create vDPA device

1) unregister netdev
2) vDPA is probed, bar config set to vDPA

And when vDPA device is deleted:

1) unregister vDPA
2) netdev is probed, bat config set to netdev

There would be a lot of side effects for the mandated policy of
registering/unregistering netdevs like udev events etc when adding and
removing vDPA devices.

Thanks

>
> Martin
>


2023-03-17 11:01:46

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 09/14] sfc: implement device status related vdpa config operations


On 3/15/23 22:48, Gautam Dawar wrote:
>
> On 3/15/23 10:30, Jason Wang wrote:
>> Caution: This message originated from an External Source. Use proper
>> caution when opening attachments, clicking links, or responding.
>>
>>
>> 在 2023/3/13 20:10, Gautam Dawar 写道:
>>>
>>> On 3/10/23 10:35, Jason Wang wrote:
>>>> Caution: This message originated from an External Source. Use proper
>>>> caution when opening attachments, clicking links, or responding.
>>>>
>>>>
>>>> On Tue, Mar 7, 2023 at 7:38 PM Gautam Dawar <[email protected]>
>>>> wrote:
>>>>> vDPA config opertions to handle get/set device status and device
>>>>> reset have been implemented. Also .suspend config operation is
>>>>> implemented to support Live Migration.
>>>>>
>>>>> Signed-off-by: Gautam Dawar <[email protected]>
>>>>> ---
>>>>>   drivers/net/ethernet/sfc/ef100_vdpa.c     |  16 +-
>>>>>   drivers/net/ethernet/sfc/ef100_vdpa.h     |   2 +
>>>>>   drivers/net/ethernet/sfc/ef100_vdpa_ops.c | 367
>>>>> ++++++++++++++++++++--
>>>>>   3 files changed, 355 insertions(+), 30 deletions(-)
>>>>>
>>>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>>> b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>>> index c66e5aef69ea..4ba57827a6cd 100644
>>>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.c
>>>>> @@ -68,9 +68,14 @@ static int vdpa_allocate_vis(struct efx_nic *efx,
>>>>> unsigned int *allocated_vis)
>>>>>
>>>>>   static void ef100_vdpa_delete(struct efx_nic *efx)
>>>>>   {
>>>>> +       struct vdpa_device *vdpa_dev;
>>>>> +
>>>>>          if (efx->vdpa_nic) {
>>>>> +               vdpa_dev = &efx->vdpa_nic->vdpa_dev;
>>>>> +               ef100_vdpa_reset(vdpa_dev);
>>>>> +
>>>>>                  /* replace with _vdpa_unregister_device later */
>>>>> - put_device(&efx->vdpa_nic->vdpa_dev.dev);
>>>>> +               put_device(&vdpa_dev->dev);
>>>>>          }
>>>>>          efx_mcdi_free_vis(efx);
>>>>>   }
>>>>> @@ -171,6 +176,15 @@ static struct ef100_vdpa_nic
>>>>> *ef100_vdpa_create(struct efx_nic *efx,
>>>>>                  }
>>>>>          }
>>>>>
>>>>> +       rc = devm_add_action_or_reset(&efx->pci_dev->dev,
>>>>> + ef100_vdpa_irq_vectors_free,
>>>>> +                                     efx->pci_dev);
>>>>> +       if (rc) {
>>>>> +               pci_err(efx->pci_dev,
>>>>> +                       "Failed adding devres for freeing irq
>>>>> vectors\n");
>>>>> +               goto err_put_device;
>>>>> +       }
>>>>> +
>>>>>          rc = get_net_config(vdpa_nic);
>>>>>          if (rc)
>>>>>                  goto err_put_device;
>>>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>>> b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>>> index 348ca8a7404b..58791402e454 100644
>>>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>>> @@ -149,6 +149,8 @@ int ef100_vdpa_register_mgmtdev(struct efx_nic
>>>>> *efx);
>>>>>   void ef100_vdpa_unregister_mgmtdev(struct efx_nic *efx);
>>>>>   void ef100_vdpa_irq_vectors_free(void *data);
>>>>>   int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16
>>>>> idx);
>>>>> +void ef100_vdpa_irq_vectors_free(void *data);
>>>>> +int ef100_vdpa_reset(struct vdpa_device *vdev);
>>>>>
>>>>>   static inline bool efx_vdpa_is_little_endian(struct ef100_vdpa_nic
>>>>> *vdpa_nic)
>>>>>   {
>>>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>>> b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>>> index 0051c4c0e47c..95a2177f85a2 100644
>>>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa_ops.c
>>>>> @@ -22,11 +22,6 @@ static struct ef100_vdpa_nic *get_vdpa_nic(struct
>>>>> vdpa_device *vdev)
>>>>>          return container_of(vdev, struct ef100_vdpa_nic, vdpa_dev);
>>>>>   }
>>>>>
>>>>> -void ef100_vdpa_irq_vectors_free(void *data)
>>>>> -{
>>>>> -       pci_free_irq_vectors(data);
>>>>> -}
>>>>> -
>>>>>   static int create_vring_ctx(struct ef100_vdpa_nic *vdpa_nic, u16
>>>>> idx)
>>>>>   {
>>>>>          struct efx_vring_ctx *vring_ctx;
>>>>> @@ -52,14 +47,6 @@ static void delete_vring_ctx(struct
>>>>> ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>>>          vdpa_nic->vring[idx].vring_ctx = NULL;
>>>>>   }
>>>>>
>>>>> -static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>>> -{
>>>>> -       vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>>>>> -       vdpa_nic->vring[idx].vring_state = 0;
>>>>> -       vdpa_nic->vring[idx].last_avail_idx = 0;
>>>>> -       vdpa_nic->vring[idx].last_used_idx = 0;
>>>>> -}
>>>>> -
>>>>>   int ef100_vdpa_init_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>>>   {
>>>>>          u32 offset;
>>>>> @@ -103,6 +90,236 @@ static bool is_qid_invalid(struct
>>>>> ef100_vdpa_nic *vdpa_nic, u16 idx,
>>>>>          return false;
>>>>>   }
>>>>>
>>>>> +static void irq_vring_fini(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>>> +{
>>>>> +       struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
>>>>> +       struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
>>>>> +
>>>>> +       devm_free_irq(&pci_dev->dev, vring->irq, vring);
>>>>> +       vring->irq = -EINVAL;
>>>>> +}
>>>>> +
>>>>> +static irqreturn_t vring_intr_handler(int irq, void *arg)
>>>>> +{
>>>>> +       struct ef100_vdpa_vring_info *vring = arg;
>>>>> +
>>>>> +       if (vring->cb.callback)
>>>>> +               return vring->cb.callback(vring->cb.private);
>>>>> +
>>>>> +       return IRQ_NONE;
>>>>> +}
>>>>> +
>>>>> +static int ef100_vdpa_irq_vectors_alloc(struct pci_dev *pci_dev,
>>>>> u16 nvqs)
>>>>> +{
>>>>> +       int rc;
>>>>> +
>>>>> +       rc = pci_alloc_irq_vectors(pci_dev, nvqs, nvqs,
>>>>> PCI_IRQ_MSIX);
>>>>> +       if (rc < 0)
>>>>> +               pci_err(pci_dev,
>>>>> +                       "Failed to alloc %d IRQ vectors, err:%d\n",
>>>>> nvqs, rc);
>>>>> +       return rc;
>>>>> +}
>>>>> +
>>>>> +void ef100_vdpa_irq_vectors_free(void *data)
>>>>> +{
>>>>> +       pci_free_irq_vectors(data);
>>>>> +}
>>>>> +
>>>>> +static int irq_vring_init(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>>> +{
>>>>> +       struct ef100_vdpa_vring_info *vring = &vdpa_nic->vring[idx];
>>>>> +       struct pci_dev *pci_dev = vdpa_nic->efx->pci_dev;
>>>>> +       int irq;
>>>>> +       int rc;
>>>>> +
>>>>> +       snprintf(vring->msix_name, 256, "x_vdpa[%s]-%d\n",
>>>>> +                pci_name(pci_dev), idx);
>>>>> +       irq = pci_irq_vector(pci_dev, idx);
>>>>> +       rc = devm_request_irq(&pci_dev->dev, irq,
>>>>> vring_intr_handler, 0,
>>>>> +                             vring->msix_name, vring);
>>>>> +       if (rc)
>>>>> +               pci_err(pci_dev,
>>>>> +                       "devm_request_irq failed for vring %d, rc
>>>>> %d\n",
>>>>> +                       idx, rc);
>>>>> +       else
>>>>> +               vring->irq = irq;
>>>>> +
>>>>> +       return rc;
>>>>> +}
>>>>> +
>>>>> +static int delete_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>>> +{
>>>>> +       struct efx_vring_dyn_cfg vring_dyn_cfg;
>>>>> +       int rc;
>>>>> +
>>>>> +       if (!(vdpa_nic->vring[idx].vring_state &
>>>>> EF100_VRING_CREATED))
>>>>> +               return 0;
>>>>> +
>>>>> +       rc = efx_vdpa_vring_destroy(vdpa_nic->vring[idx].vring_ctx,
>>>>> +                                   &vring_dyn_cfg);
>>>>> +       if (rc)
>>>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>>>> +                       "%s: delete vring failed index:%u, err:%d\n",
>>>>> +                       __func__, idx, rc);
>>>>> +       vdpa_nic->vring[idx].last_avail_idx =
>>>>> vring_dyn_cfg.avail_idx;
>>>>> +       vdpa_nic->vring[idx].last_used_idx = vring_dyn_cfg.used_idx;
>>>>> +       vdpa_nic->vring[idx].vring_state &= ~EF100_VRING_CREATED;
>>>>> +
>>>>> +       irq_vring_fini(vdpa_nic, idx);
>>>>> +
>>>>> +       return rc;
>>>>> +}
>>>>> +
>>>>> +static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>>>>> +{
>>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>>> +       u32 idx_val;
>>>>> +
>>>>> +       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>>> +               return;
>>>>> +
>>>>> +       if (!(vdpa_nic->vring[idx].vring_state &
>>>>> EF100_VRING_CREATED))
>>>>> +               return;
>>>>> +
>>>>> +       idx_val = idx;
>>>>> +       _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>>>>> + vdpa_nic->vring[idx].doorbell_offset);
>>>>> +}
>>>>> +
>>>>> +static bool can_create_vring(struct ef100_vdpa_nic *vdpa_nic, u16
>>>>> idx)
>>>>> +{
>>>>> +       if (vdpa_nic->vring[idx].vring_state ==
>>>>> EF100_VRING_CONFIGURED &&
>>>>> +           vdpa_nic->status & VIRTIO_CONFIG_S_DRIVER_OK &&
>>>>> +           !(vdpa_nic->vring[idx].vring_state &
>>>>> EF100_VRING_CREATED))
>>>>> +               return true;
>>>>> +
>>>>> +       return false;
>>>>> +}
>>>>> +
>>>>> +static int create_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>>> +{
>>>>> +       struct efx_vring_dyn_cfg vring_dyn_cfg;
>>>>> +       struct efx_vring_cfg vring_cfg;
>>>>> +       int rc;
>>>>> +
>>>>> +       rc = irq_vring_init(vdpa_nic, idx);
>>>>> +       if (rc) {
>>>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>>>> +                       "%s: irq_vring_init failed. index:%u,
>>>>> err:%d\n",
>>>>> +                       __func__, idx, rc);
>>>>> +               return rc;
>>>>> +       }
>>>>> +       vring_cfg.desc = vdpa_nic->vring[idx].desc;
>>>>> +       vring_cfg.avail = vdpa_nic->vring[idx].avail;
>>>>> +       vring_cfg.used = vdpa_nic->vring[idx].used;
>>>>> +       vring_cfg.size = vdpa_nic->vring[idx].size;
>>>>> +       vring_cfg.features = vdpa_nic->features;
>>>>> +       vring_cfg.msix_vector = idx;
>>>>> +       vring_dyn_cfg.avail_idx =
>>>>> vdpa_nic->vring[idx].last_avail_idx;
>>>>> +       vring_dyn_cfg.used_idx = vdpa_nic->vring[idx].last_used_idx;
>>>>> +
>>>>> +       rc = efx_vdpa_vring_create(vdpa_nic->vring[idx].vring_ctx,
>>>>> +                                  &vring_cfg, &vring_dyn_cfg);
>>>>> +       if (rc) {
>>>>> +               dev_err(&vdpa_nic->vdpa_dev.dev,
>>>>> +                       "%s: vring_create failed index:%u, err:%d\n",
>>>>> +                       __func__, idx, rc);
>>>>> +               goto err_vring_create;
>>>>> +       }
>>>>> +       vdpa_nic->vring[idx].vring_state |= EF100_VRING_CREATED;
>>>>> +
>>>>> +       /* A VQ kick allows the device to read the avail_idx, which
>>>>> will be
>>>>> +        * required at the destination after live migration.
>>>>> +        */
>>>>> +       ef100_vdpa_kick_vq(&vdpa_nic->vdpa_dev, idx);
>>>>> +
>>>>> +       return 0;
>>>>> +
>>>>> +err_vring_create:
>>>>> +       irq_vring_fini(vdpa_nic, idx);
>>>>> +       return rc;
>>>>> +}
>>>>> +
>>>>> +static void reset_vring(struct ef100_vdpa_nic *vdpa_nic, u16 idx)
>>>>> +{
>>>>> +       delete_vring(vdpa_nic, idx);
>>>>> +       vdpa_nic->vring[idx].vring_type = EF100_VDPA_VQ_NTYPES;
>>>>> +       vdpa_nic->vring[idx].vring_state = 0;
>>>>> +       vdpa_nic->vring[idx].last_avail_idx = 0;
>>>>> +       vdpa_nic->vring[idx].last_used_idx = 0;
>>>>> +}
>>>>> +
>>>>> +static void ef100_reset_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>>>>> +{
>>>>> +       int i;
>>>>> +
>>>>> +       WARN_ON(!mutex_is_locked(&vdpa_nic->lock));
>>>>> +
>>>>> +       if (!vdpa_nic->status)
>>>>> +               return;
>>>>> +
>>>>> +       vdpa_nic->vdpa_state = EF100_VDPA_STATE_INITIALIZED;
>>>>> +       vdpa_nic->status = 0;
>>>>> +       vdpa_nic->features = 0;
>>>>> +       for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++)
>>>>> +               reset_vring(vdpa_nic, i);
>>>>> + ef100_vdpa_irq_vectors_free(vdpa_nic->efx->pci_dev);
>>>>> +}
>>>>> +
>>>>> +/* May be called under the rtnl lock */
>>>>> +int ef100_vdpa_reset(struct vdpa_device *vdev)
>>>>> +{
>>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>>> +
>>>>> +       /* vdpa device can be deleted anytime but the bar_config
>>>>> +        * could still be vdpa and hence efx->state would be
>>>>> STATE_VDPA.
>>>>> +        * Accordingly, ensure vdpa device exists before reset
>>>>> handling
>>>>> +        */
>>>>> +       if (!vdpa_nic)
>>>>> +               return -ENODEV;
>>>>> +
>>>>> +       mutex_lock(&vdpa_nic->lock);
>>>>> +       ef100_reset_vdpa_device(vdpa_nic);
>>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>>> +       return 0;
>>>>> +}
>>>>> +
>>>>> +static int start_vdpa_device(struct ef100_vdpa_nic *vdpa_nic)
>>>>> +{
>>>>> +       struct efx_nic *efx = vdpa_nic->efx;
>>>>> +       struct ef100_nic_data *nic_data;
>>>>> +       int i, j;
>>>>> +       int rc;
>>>>> +
>>>>> +       nic_data = efx->nic_data;
>>>>> +       rc = ef100_vdpa_irq_vectors_alloc(efx->pci_dev,
>>>>> + vdpa_nic->max_queue_pairs * 2);
>>>>> +       if (rc < 0) {
>>>>> +               pci_err(efx->pci_dev,
>>>>> +                       "vDPA IRQ alloc failed for vf: %u err:%d\n",
>>>>> +                       nic_data->vf_index, rc);
>>>>> +               return rc;
>>>>> +       }
>>>>> +
>>>>> +       for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>>>>> +               if (can_create_vring(vdpa_nic, i)) {
>>>>> +                       rc = create_vring(vdpa_nic, i);
>>>>> +                       if (rc)
>>>>> +                               goto clear_vring;
>>>>> +               }
>>>>> +       }
>>>>> +
>>>>> +       vdpa_nic->vdpa_state = EF100_VDPA_STATE_STARTED;
>>>> It looks to me that this duplicates with the DRIVER_OK status bit.
>>> vdpa_state is set EF100_VDPA_STATE_STARTED during DRIVER_OK handling.
>>> See my later response for its purpose.
>>>>
>>>>> +       return 0;
>>>>> +
>>>>> +clear_vring:
>>>>> +       for (j = 0; j < i; j++)
>>>>> +               delete_vring(vdpa_nic, j);
>>>>> +
>>>>> +       ef100_vdpa_irq_vectors_free(efx->pci_dev);
>>>>> +       return rc;
>>>>> +}
>>>>> +
>>>>>   static int ef100_vdpa_set_vq_address(struct vdpa_device *vdev,
>>>>>                                       u16 idx, u64 desc_area, u64
>>>>> driver_area,
>>>>>                                       u64 device_area)
>>>>> @@ -144,22 +361,6 @@ static void ef100_vdpa_set_vq_num(struct
>>>>> vdpa_device *vdev, u16 idx, u32 num)
>>>>>          mutex_unlock(&vdpa_nic->lock);
>>>>>   }
>>>>>
>>>>> -static void ef100_vdpa_kick_vq(struct vdpa_device *vdev, u16 idx)
>>>>> -{
>>>>> -       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>>> -       u32 idx_val;
>>>>> -
>>>>> -       if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>>> -               return;
>>>>> -
>>>>> -       if (!(vdpa_nic->vring[idx].vring_state &
>>>>> EF100_VRING_CREATED))
>>>>> -               return;
>>>>> -
>>>>> -       idx_val = idx;
>>>>> -       _efx_writed(vdpa_nic->efx, cpu_to_le32(idx_val),
>>>>> - vdpa_nic->vring[idx].doorbell_offset);
>>>>> -}
>>>>> -
>>>>>   static void ef100_vdpa_set_vq_cb(struct vdpa_device *vdev, u16 idx,
>>>>>                                   struct vdpa_callback *cb)
>>>>>   {
>>>>> @@ -176,6 +377,7 @@ static void ef100_vdpa_set_vq_ready(struct
>>>>> vdpa_device *vdev, u16 idx,
>>>>>                                      bool ready)
>>>>>   {
>>>>>          struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>>> +       int rc;
>>>>>
>>>>>          if (is_qid_invalid(vdpa_nic, idx, __func__))
>>>>>                  return;
>>>>> @@ -184,9 +386,21 @@ static void ef100_vdpa_set_vq_ready(struct
>>>>> vdpa_device *vdev, u16 idx,
>>>>>          if (ready) {
>>>>>                  vdpa_nic->vring[idx].vring_state |=
>>>>> EF100_VRING_READY_CONFIGURED;
>>>>> +               if (vdpa_nic->vdpa_state ==
>>>>> EF100_VDPA_STATE_STARTED &&
>>>>> +                   can_create_vring(vdpa_nic, idx)) {
>>>>> +                       rc = create_vring(vdpa_nic, idx);
>>>>> +                       if (rc)
>>>>> +                               /* Rollback ready configuration
>>>>> +                                * So that the above layer driver
>>>>> +                                * can make another attempt to set
>>>>> ready
>>>>> +                                */
>>>>> + vdpa_nic->vring[idx].vring_state &=
>>>>> + ~EF100_VRING_READY_CONFIGURED;
>>>>> +               }
>>>>>          } else {
>>>>>                  vdpa_nic->vring[idx].vring_state &=
>>>>> ~EF100_VRING_READY_CONFIGURED;
>>>>> +               delete_vring(vdpa_nic, idx);
>>>>>          }
>>>>>          mutex_unlock(&vdpa_nic->lock);
>>>>>   }
>>>>> @@ -296,6 +510,12 @@ static u64
>>>>> ef100_vdpa_get_device_features(struct vdpa_device *vdev)
>>>>>          }
>>>>>
>>>>>          features |= BIT_ULL(VIRTIO_NET_F_MAC);
>>>>> +       /* As QEMU SVQ doesn't implement the following features,
>>>>> +        * masking them off to allow Live Migration
>>>>> +        */
>>>>> +       features &= ~BIT_ULL(VIRTIO_F_IN_ORDER);
>>>>> +       features &= ~BIT_ULL(VIRTIO_F_ORDER_PLATFORM);
>>>> It's better not to work around userspace bugs in the kernel. We should
>>>> fix Qemu instead.
>>>
>>> There's already a QEMU patch [1] submitted to support
>>> VIRTIO_F_ORDER_PLATFORM but it hasn't concluded yet. Also, there is no
>>> support for VIRTIO_F_IN_ORDER in the kernel virtio driver. The motive
>>> of this change is to have VM Live Migration working with the kernel
>>> in-tree driver without requiring any changes.
>>>
>>> Once QEMU is able to handle these features, we can submit a patch to
>>> undo these changes.
>>
>>
>> I can understand the motivation, but it works for prototyping but not
>> formal kernel code (especially consider SVQ is not mature and still
>> being development). What's more, we can not assume Qemu is the only
>> user, we have other users like DPDK and cloud-hypervisors.
>
> Ok, if the expectation is to have the user deal with the issues and
> make required changes on the in-tree driver to make it work, I'll
> remove this part.
>
>>
>> Thanks
>>
>>
>>>
>>>>
>>>>> +
>>>>>          return features;
>>>>>   }
>>>>>
>>>>> @@ -356,6 +576,77 @@ static u32 ef100_vdpa_get_vendor_id(struct
>>>>> vdpa_device *vdev)
>>>>>          return EF100_VDPA_VENDOR_ID;
>>>>>   }
>>>>>
>>>>> +static u8 ef100_vdpa_get_status(struct vdpa_device *vdev)
>>>>> +{
>>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>>> +       u8 status;
>>>>> +
>>>>> +       mutex_lock(&vdpa_nic->lock);
>>>>> +       status = vdpa_nic->status;
>>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>>> +       return status;
>>>>> +}
>>>>> +
>>>>> +static void ef100_vdpa_set_status(struct vdpa_device *vdev, u8
>>>>> status)
>>>>> +{
>>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>>> +       u8 new_status;
>>>>> +       int rc;
>>>>> +
>>>>> +       mutex_lock(&vdpa_nic->lock);
>>>>> +       if (!status) {
>>>>> +               dev_info(&vdev->dev,
>>>>> +                        "%s: Status received is 0. Device reset
>>>>> being done\n",
>>>>> +                        __func__);
>>>> This is trigger-able by the userspace. It might be better to use
>>>> dev_dbg() instead.
>>> Will change.
>>>>
>>>>> + ef100_reset_vdpa_device(vdpa_nic);
>>>>> +               goto unlock_return;
>>>>> +       }
>>>>> +       new_status = status & ~vdpa_nic->status;
>>>>> +       if (new_status == 0) {
>>>>> +               dev_info(&vdev->dev,
>>>>> +                        "%s: New status same as current status\n",
>>>>> __func__);
>>>> Same here.
>>> Ok.
>>>>
>>>>> +               goto unlock_return;
>>>>> +       }
>>>>> +       if (new_status & VIRTIO_CONFIG_S_FAILED) {
>>>>> +               ef100_reset_vdpa_device(vdpa_nic);
>>>>> +               goto unlock_return;
>>>>> +       }
>>>>> +
>>>>> +       if (new_status & VIRTIO_CONFIG_S_ACKNOWLEDGE) {
>>>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_ACKNOWLEDGE;
>>>>> +               new_status &= ~VIRTIO_CONFIG_S_ACKNOWLEDGE;
>>>>> +       }
>>>>> +       if (new_status & VIRTIO_CONFIG_S_DRIVER) {
>>>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER;
>>>>> +               new_status &= ~VIRTIO_CONFIG_S_DRIVER;
>>>>> +       }
>>>>> +       if (new_status & VIRTIO_CONFIG_S_FEATURES_OK) {
>>>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_FEATURES_OK;
>>>>> +               vdpa_nic->vdpa_state = EF100_VDPA_STATE_NEGOTIATED;
>>>> It might be better to explain the reason we need to track another
>>>> state in vdpa_state instead of simply using the device status.
>>> vdpa_state helps to ensure correct status transitions in the
>>> .set_status callback and safe-guards against incorrect/malicious
>>> user-space driver.
>>
>>
>> Ok, let's document this in the definition of vdpa_state.
> Sure, will do.
>>
>>
>>>>
>>>>> +               new_status &= ~VIRTIO_CONFIG_S_FEATURES_OK;
>>>>> +       }
>>>>> +       if (new_status & VIRTIO_CONFIG_S_DRIVER_OK &&
>>>>> +           vdpa_nic->vdpa_state == EF100_VDPA_STATE_NEGOTIATED) {
>>>>> +               vdpa_nic->status |= VIRTIO_CONFIG_S_DRIVER_OK;
>>>>> +               rc = start_vdpa_device(vdpa_nic);
>>>>> +               if (rc) {
>>>>> + dev_err(&vdpa_nic->vdpa_dev.dev,
>>>>> +                               "%s: vDPA device failed:%d\n",
>>>>> __func__, rc);
>>>>> +                       vdpa_nic->status &=
>>>>> ~VIRTIO_CONFIG_S_DRIVER_OK;
>>>>> +                       goto unlock_return;
>>>>> +               }
>>>>> +               new_status &= ~VIRTIO_CONFIG_S_DRIVER_OK;
>>>>> +       }
>>>>> +       if (new_status) {
>>>>> +               dev_warn(&vdev->dev,
>>>>> +                        "%s: Mismatch Status: %x & State: %u\n",
>>>>> +                        __func__, new_status, vdpa_nic->vdpa_state);
>>>>> +       }
>>>>> +
>>>>> +unlock_return:
>>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>>> +}
>>>>> +
>>>>>   static size_t ef100_vdpa_get_config_size(struct vdpa_device *vdev)
>>>>>   {
>>>>>          return sizeof(struct virtio_net_config);
>>>>> @@ -393,6 +684,20 @@ static void ef100_vdpa_set_config(struct
>>>>> vdpa_device *vdev, unsigned int offset,
>>>>>                  vdpa_nic->mac_configured = true;
>>>>>   }
>>>>>
>>>>> +static int ef100_vdpa_suspend(struct vdpa_device *vdev)
>>>>> +{
>>>>> +       struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>>> +       int i, rc;
>>>>> +
>>>>> +       mutex_lock(&vdpa_nic->lock);
>>>>> +       for (i = 0; i < (vdpa_nic->max_queue_pairs * 2); i++) {
>>>>> +               rc = delete_vring(vdpa_nic, i);
>>>> Note that the suspension matters for the whole device. It means the
>>>> config space should not be changed. But the code here only suspends
>>>> the vring, is this intende/d?
>>> Are you referring to the possibility of updating device configuration
>>> (eg. MAC address) using .set_config() after suspend operation? Is
>>> there any other user triggered operation that falls in this category?
>>
>>
>> Updating MAC should be prohibited, one typical use case is the link
>> status.
> I think this can be dealt with an additional SUSPEND state which can
> be used to avoid any changes to the config space.
>>
>>
>>>>
>>>> Reset may have the same issue.
>>> Could you pls elaborate on the requirement during device reset?
>>
>>
>> I meant ef100_reset_vdpa_device() may suffer from the same issue:
>>
>> It only reset all the vring but not the config space?
>
> Ok, I think resetting config space would basically be clearing the
> memory for vdpa_nic->net_config which is the initial state after vdpa
> device allocation.

On second thought, the virtio_net_config data except mac is static
(updated during vdpa device creation) and must not be cleared during
device reset. Also, as currently the MAC address of the existing vdpa
device can't be updated, it too should not be cleared.

Gautam

>
>
> Gautam
>
>>
>> Thanks
>>
>>
>>>>
>>>> Thanks
>>> [1]
>>> https://patchew.org/QEMU/[email protected]/
>>>>
>>>>> +               if (rc)
>>>>> +                       break;
>>>>> +       }
>>>>> +       mutex_unlock(&vdpa_nic->lock);
>>>>> +       return rc;
>>>>> +}
>>>>>   static void ef100_vdpa_free(struct vdpa_device *vdev)
>>>>>   {
>>>>>          struct ef100_vdpa_nic *vdpa_nic = get_vdpa_nic(vdev);
>>>>> @@ -428,9 +733,13 @@ const struct vdpa_config_ops
>>>>> ef100_vdpa_config_ops = {
>>>>>          .get_vq_num_max      = ef100_vdpa_get_vq_num_max,
>>>>>          .get_device_id       = ef100_vdpa_get_device_id,
>>>>>          .get_vendor_id       = ef100_vdpa_get_vendor_id,
>>>>> +       .get_status          = ef100_vdpa_get_status,
>>>>> +       .set_status          = ef100_vdpa_set_status,
>>>>> +       .reset               = ef100_vdpa_reset,
>>>>>          .get_config_size     = ef100_vdpa_get_config_size,
>>>>>          .get_config          = ef100_vdpa_get_config,
>>>>>          .set_config          = ef100_vdpa_set_config,
>>>>>          .get_generation      = NULL,
>>>>> +       .suspend             = ef100_vdpa_suspend,
>>>>>          .free                = ef100_vdpa_free,
>>>>>   };
>>>>> --
>>>>> 2.30.1
>>>>>
>>>
>>

2023-03-17 11:19:26

by Gautam Dawar

[permalink] [raw]
Subject: Re: [PATCH net-next v2 04/14] sfc: evaluate vdpa support based on FW capability CLIENT_CMD_VF_PROXY


On 3/14/23 14:08, Martin Habets wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Mon, Mar 13, 2023 at 06:09:19PM +0530, Gautam Dawar wrote:
>> On 3/10/23 10:34, Jason Wang wrote:
>>> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>>>
>>>
>>> On Tue, Mar 7, 2023 at 7:37 PM Gautam Dawar <[email protected]> wrote:
>>>> Add and update vdpa_supported field to struct efx_nic to true if
>>>> running Firmware supports CLIENT_CMD_VF_PROXY capability. This is
>>>> required to ensure DMA isolation between MCDI command buffer and guest
>>>> buffers.
>>>>
>>>> Signed-off-by: Gautam Dawar <[email protected]>
>>>> ---
>>>> drivers/net/ethernet/sfc/ef100_netdev.c | 26 +++++++++++++++---
>>>> drivers/net/ethernet/sfc/ef100_nic.c | 35 +++++++++----------------
>>>> drivers/net/ethernet/sfc/ef100_nic.h | 6 +++--
>>>> drivers/net/ethernet/sfc/ef100_vdpa.h | 5 ++--
>>>> 4 files changed, 41 insertions(+), 31 deletions(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c
>>>> index d916877b5a9a..5d93e870d9b7 100644
>>>> --- a/drivers/net/ethernet/sfc/ef100_netdev.c
>>>> +++ b/drivers/net/ethernet/sfc/ef100_netdev.c
>>>> @@ -355,6 +355,28 @@ void ef100_remove_netdev(struct efx_probe_data *probe_data)
>>>> efx->state = STATE_PROBED;
>>>> }
>>>>
>>>> +static void efx_ef100_update_tso_features(struct efx_nic *efx)
>>>> +{
>>>> + struct ef100_nic_data *nic_data = efx->nic_data;
>>>> + struct net_device *net_dev = efx->net_dev;
>>>> + netdev_features_t tso;
>>>> +
>>>> + if (!efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3))
>>>> + return;
>>>> +
>>>> + tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
>>>> + NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
>>>> + NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
>>>> +
>>>> + net_dev->features |= tso;
>>>> + net_dev->hw_features |= tso;
>>>> + net_dev->hw_enc_features |= tso;
>>>> + /* EF100 HW can only offload outer checksums if they are UDP,
>>>> + * so for GRE_CSUM we have to use GSO_PARTIAL.
>>>> + */
>>>> + net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
>>>> +}
>>> I don't see a direct relationship between vDPA and the TSO capability.
>>> Is this an independent fix?
>> This isn't actually fixing any issue. This a minor code refactoring that
>> wraps-up updating of the TSO capabilities in a separate function for better
>> readability.
> There definity was an issue here: the vDPA code now needs access to the NIC
> capabilities. For this is should use the efx_ef100_init_datapath_caps below,
> but that was also doing this netdev specific stuff.
> The solution is to split up efx_ef100_init_datapath_caps into a generic API
> that vDPA can use, and this netdev specific API which should not be used by vDPA.
>
> Gautam, you could explain this API split in the description.

Sure, will update the commit description with this information.

Thanks

>
> Martin
>
>>>> +
>>>> int ef100_probe_netdev(struct efx_probe_data *probe_data)
>>>> {
>>>> struct efx_nic *efx = &probe_data->efx;
>>>> @@ -387,9 +409,7 @@ int ef100_probe_netdev(struct efx_probe_data *probe_data)
>>>> ESE_EF100_DP_GZ_TSO_MAX_HDR_NUM_SEGS_DEFAULT);
>>>> efx->mdio.dev = net_dev;
>>>>
>>>> - rc = efx_ef100_init_datapath_caps(efx);
>>>> - if (rc < 0)
>>>> - goto fail;
>>>> + efx_ef100_update_tso_features(efx);
>>>>
>>>> rc = ef100_phy_probe(efx);
>>>> if (rc)
>>>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
>>>> index 8cbe5e0f4bdf..ef6e295efcf7 100644
>>>> --- a/drivers/net/ethernet/sfc/ef100_nic.c
>>>> +++ b/drivers/net/ethernet/sfc/ef100_nic.c
>>>> @@ -161,7 +161,7 @@ int ef100_get_mac_address(struct efx_nic *efx, u8 *mac_address,
>>>> return 0;
>>>> }
>>>>
>>>> -int efx_ef100_init_datapath_caps(struct efx_nic *efx)
>>>> +static int efx_ef100_init_datapath_caps(struct efx_nic *efx)
>>>> {
>>>> MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_V7_OUT_LEN);
>>>> struct ef100_nic_data *nic_data = efx->nic_data;
>>>> @@ -197,25 +197,15 @@ int efx_ef100_init_datapath_caps(struct efx_nic *efx)
>>>> if (rc)
>>>> return rc;
>>>>
>>>> - if (efx_ef100_has_cap(nic_data->datapath_caps2, TX_TSO_V3)) {
>>>> - struct net_device *net_dev = efx->net_dev;
>>>> - netdev_features_t tso = NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_GSO_PARTIAL |
>>>> - NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM |
>>>> - NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM;
>>>> -
>>>> - net_dev->features |= tso;
>>>> - net_dev->hw_features |= tso;
>>>> - net_dev->hw_enc_features |= tso;
>>>> - /* EF100 HW can only offload outer checksums if they are UDP,
>>>> - * so for GRE_CSUM we have to use GSO_PARTIAL.
>>>> - */
>>>> - net_dev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM;
>>>> - }
>>>> efx->num_mac_stats = MCDI_WORD(outbuf,
>>>> GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS);
>>>> netif_dbg(efx, probe, efx->net_dev,
>>>> "firmware reports num_mac_stats = %u\n",
>>>> efx->num_mac_stats);
>>>> +
>>>> + nic_data->vdpa_supported = efx_ef100_has_cap(nic_data->datapath_caps3,
>>>> + CLIENT_CMD_VF_PROXY) &&
>>>> + efx->type->is_vf;
>>>> return 0;
>>>> }
>>>>
>>>> @@ -806,13 +796,6 @@ static char *bar_config_name[] = {
>>>> [EF100_BAR_CONFIG_VDPA] = "vDPA",
>>>> };
>>>>
>>>> -#ifdef CONFIG_SFC_VDPA
>>>> -static bool efx_vdpa_supported(struct efx_nic *efx)
>>>> -{
>>>> - return efx->type->is_vf;
>>>> -}
>>>> -#endif
>>>> -
>>>> int efx_ef100_set_bar_config(struct efx_nic *efx,
>>>> enum ef100_bar_config new_config)
>>>> {
>>>> @@ -828,7 +811,7 @@ int efx_ef100_set_bar_config(struct efx_nic *efx,
>>>>
>>>> #ifdef CONFIG_SFC_VDPA
>>>> /* Current EF100 hardware supports vDPA on VFs only */
>>>> - if (new_config == EF100_BAR_CONFIG_VDPA && !efx_vdpa_supported(efx)) {
>>>> + if (new_config == EF100_BAR_CONFIG_VDPA && !nic_data->vdpa_supported) {
>>>> pci_err(efx->pci_dev, "vdpa over PF not supported : %s",
>>>> efx->name);
>>>> return -EOPNOTSUPP;
>>>> @@ -1208,6 +1191,12 @@ static int ef100_probe_main(struct efx_nic *efx)
>>>> goto fail;
>>>> }
>>>>
>>>> + rc = efx_ef100_init_datapath_caps(efx);
>>>> + if (rc) {
>>>> + pci_info(efx->pci_dev, "Unable to initialize datapath caps\n");
>>>> + goto fail;
>>>> + }
>>>> +
>>>> return 0;
>>>> fail:
>>>> return rc;
>>>> diff --git a/drivers/net/ethernet/sfc/ef100_nic.h b/drivers/net/ethernet/sfc/ef100_nic.h
>>>> index 4562982f2965..117a73d0795c 100644
>>>> --- a/drivers/net/ethernet/sfc/ef100_nic.h
>>>> +++ b/drivers/net/ethernet/sfc/ef100_nic.h
>>>> @@ -76,6 +76,9 @@ struct ef100_nic_data {
>>>> u32 datapath_caps3;
>>>> unsigned int pf_index;
>>>> u16 warm_boot_count;
>>>> +#ifdef CONFIG_SFC_VDPA
>>>> + bool vdpa_supported; /* true if vdpa is supported on this PCIe FN */
>>>> +#endif
>>>> u8 port_id[ETH_ALEN];
>>>> DECLARE_BITMAP(evq_phases, EFX_MAX_CHANNELS);
>>>> enum ef100_bar_config bar_config;
>>>> @@ -95,9 +98,8 @@ struct ef100_nic_data {
>>>> };
>>>>
>>>> #define efx_ef100_has_cap(caps, flag) \
>>>> - (!!((caps) & BIT_ULL(MC_CMD_GET_CAPABILITIES_V4_OUT_ ## flag ## _LBN)))
>>>> + (!!((caps) & BIT_ULL(MC_CMD_GET_CAPABILITIES_V7_OUT_ ## flag ## _LBN)))
>>>>
>>>> -int efx_ef100_init_datapath_caps(struct efx_nic *efx);
>>>> int ef100_phy_probe(struct efx_nic *efx);
>>>> int ef100_filter_table_probe(struct efx_nic *efx);
>>>>
>>>> diff --git a/drivers/net/ethernet/sfc/ef100_vdpa.h b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> index f6564448d0c7..90062fd8a25d 100644
>>>> --- a/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> +++ b/drivers/net/ethernet/sfc/ef100_vdpa.h
>>>> @@ -1,7 +1,6 @@
>>>> /* SPDX-License-Identifier: GPL-2.0 */
>>>> -/* Driver for Xilinx network controllers and boards
>>>> - * Copyright (C) 2020-2022, Xilinx, Inc.
>>>> - * Copyright (C) 2022, Advanced Micro Devices, Inc.
>>>> +/* Driver for AMD network controllers and boards
>>>> + * Copyright (C) 2023, Advanced Micro Devices, Inc.
>>> Let's fix this in the patch that introduces this.
>> Sure, will fix.
>>
>> Thanks
>>
>>> Thanks
>>>
>>>
>>>
>>>> *
>>>> * This program is free software; you can redistribute it and/or modify it
>>>> * under the terms of the GNU General Public License version 2 as published
>>>> --
>>>> 2.30.1
>>>>

2023-03-21 12:17:34

by Martin Habets

[permalink] [raw]
Subject: Re: [PATCH net-next v2 01/14] sfc: add function personality support for EF100 devices

On Fri, Mar 17, 2023 at 11:52:02AM +0800, Jason Wang wrote:
> On Thu, Mar 16, 2023 at 5:07 PM Martin Habets <[email protected]> wrote:
> >
> > On Wed, Mar 15, 2023 at 01:11:23PM +0800, Jason Wang wrote:
> > >
> > > 在 2023/3/13 19:50, Martin Habets 写道:
> > > > On Fri, Mar 10, 2023 at 01:04:14PM +0800, Jason Wang wrote:
> > > > > On Tue, Mar 7, 2023 at 7:36 PM Gautam Dawar <[email protected]> wrote:
> > > > > > A function personality defines the location and semantics of
> > > > > > registers in the BAR. EF100 NICs allow different personalities
> > > > > > of a PCIe function and changing it at run-time. A total of three
> > > > > > function personalities are defined as of now: EF100, vDPA and
> > > > > > None with EF100 being the default.
> > > > > > For now, vDPA net devices can be created on a EF100 virtual
> > > > > > function and the VF personality will be changed to vDPA in the
> > > > > > process.
> > > > > >
> > > > > > Co-developed-by: Martin Habets <[email protected]>
> > > > > > Signed-off-by: Martin Habets <[email protected]>
> > > > > > Signed-off-by: Gautam Dawar <[email protected]>
> > > > > > ---
> > > > > > drivers/net/ethernet/sfc/ef100.c | 6 +-
> > > > > > drivers/net/ethernet/sfc/ef100_nic.c | 98 +++++++++++++++++++++++++++-
> > > > > > drivers/net/ethernet/sfc/ef100_nic.h | 11 ++++
> > > > > > 3 files changed, 111 insertions(+), 4 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/net/ethernet/sfc/ef100.c b/drivers/net/ethernet/sfc/ef100.c
> > > > > > index 71aab3d0480f..c1c69783db7b 100644
> > > > > > --- a/drivers/net/ethernet/sfc/ef100.c
> > > > > > +++ b/drivers/net/ethernet/sfc/ef100.c
> > > > > > @@ -429,8 +429,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
> > > > > > if (!efx)
> > > > > > return;
> > > > > >
> > > > > > - probe_data = container_of(efx, struct efx_probe_data, efx);
> > > > > > - ef100_remove_netdev(probe_data);
> > > > > > + efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_NONE);
> > > > > > #ifdef CONFIG_SFC_SRIOV
> > > > > > efx_fini_struct_tc(efx);
> > > > > > #endif
> > > > > > @@ -443,6 +442,7 @@ static void ef100_pci_remove(struct pci_dev *pci_dev)
> > > > > > pci_disable_pcie_error_reporting(pci_dev);
> > > > > >
> > > > > > pci_set_drvdata(pci_dev, NULL);
> > > > > > + probe_data = container_of(efx, struct efx_probe_data, efx);
> > > > > > efx_fini_struct(efx);
> > > > > > kfree(probe_data);
> > > > > > };
> > > > > > @@ -508,7 +508,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
> > > > > > goto fail;
> > > > > >
> > > > > > efx->state = STATE_PROBED;
> > > > > > - rc = ef100_probe_netdev(probe_data);
> > > > > > + rc = efx_ef100_set_bar_config(efx, EF100_BAR_CONFIG_EF100);
> > > > > > if (rc)
> > > > > > goto fail;
> > > > > >
> > > > > > diff --git a/drivers/net/ethernet/sfc/ef100_nic.c b/drivers/net/ethernet/sfc/ef100_nic.c
> > > > > > index 4dc643b0d2db..8cbe5e0f4bdf 100644
> > > > > > --- a/drivers/net/ethernet/sfc/ef100_nic.c
> > > > > > +++ b/drivers/net/ethernet/sfc/ef100_nic.c
> > > > > > @@ -772,6 +772,99 @@ static int efx_ef100_get_base_mport(struct efx_nic *efx)
> > > > > > return 0;
> > > > > > }
> > > > > >
> > > > > > +/* BAR configuration.
> > > > > > + * To change BAR configuration, tear down the current configuration (which
> > > > > > + * leaves the hardware in the PROBED state), and then initialise the new
> > > > > > + * BAR state.
> > > > > > + */
> > > > > > +struct ef100_bar_config_ops {
> > > > > > + int (*init)(struct efx_probe_data *probe_data);
> > > > > > + void (*fini)(struct efx_probe_data *probe_data);
> > > > > > +};
> > > > > > +
> > > > > > +static const struct ef100_bar_config_ops bar_config_ops[] = {
> > > > > > + [EF100_BAR_CONFIG_EF100] = {
> > > > > > + .init = ef100_probe_netdev,
> > > > > > + .fini = ef100_remove_netdev
> > > > > > + },
> > > > > > +#ifdef CONFIG_SFC_VDPA
> > > > > > + [EF100_BAR_CONFIG_VDPA] = {
> > > > > > + .init = NULL,
> > > > > > + .fini = NULL
> > > > > > + },
> > > > > > +#endif
> > > > > > + [EF100_BAR_CONFIG_NONE] = {
> > > > > > + .init = NULL,
> > > > > > + .fini = NULL
> > > > > > + },
> > > > > > +};
> > > > > This looks more like a mini bus implementation. I wonder if we can
> > > > > reuse an auxiliary bus here which is more user friendly for management
> > > > > tools.
> > > > When we were in the design phase of vDPA for EF100 it was still called
> > > > virtbus, and the virtbus discussion was in full swing at that time.
> > > > We could not afford to add risk to the project by depending on it, as
> > > > it might not have been merged at all.
> > >
> > >
> > > Right.
> > >
> > >
> > > > If we were doing the same design now I would definitely consider using
> > > > the auxiliary bus.
> > > >
> > > > Martin
> > >
> > >
> > > But it's not late to do the change now. Auxiliary bus has been used by a lot
> > > of devices (even with vDPA device). The change looks not too complicated.
> >
> > I'm surprised you think this would not be complicated. From my view it would
> > require redesign, redevelopment and retest of vdpa which would take months. That is
> > assuming we can get some of the resources back.
>
> I think I'm fine if we agree to do it sometime in the future.

We have projects on the roadmap that will need to use auxbus for this.
The timeline for that is not clear to me at the moment.

> >
> > > This looks more scalable and convenient for management layer.
> >
> > There is not much difference for the management layer, it uses the vdpa tool now
> > and it would do so with the auxiliary bus.
>
> At the vDPA level it doesn't make too much difference.
>
> > The difference is that with the
> > auxiliary bus users would have to load another module for sfc vDPA support.
>
> The policy is fully under the control of the management instead of the
> hard-coding policy now, more below.
>
> > Are we maybe on 2 different trains of thought here?
>
> If I read the code correct, when VF is probed:
>
> 1) vDPA mgmtdev is registered
> 2) netdev is probed, bar config set to netdev
>
> This means when user want to create vDPA device
>
> 1) unregister netdev
> 2) vDPA is probed, bar config set to vDPA
>
> And when vDPA device is deleted:
>
> 1) unregister vDPA
> 2) netdev is probed, bat config set to netdev

Your analysis is correct. We have a requirement to initially create a
netdev for new VFs. This was done to maintain backward compatibility with
earlier Solarflare NICs.
For new products I can try to change this default behaviour. I definitely
see a trend towards a core "PCI" layer and different layers on top of that.
The auxiliary bus will have a significant role to play here.

> There would be a lot of side effects for the mandated policy of
> registering/unregistering netdevs like udev events etc when adding and
> removing vDPA devices.

I agree. During our testing we cam across versions of systemd that will
cause a spike in the load when creating many netdevs.

Martin

>
> Thanks
>
> >
> > Martin
> >