if (rc != 0)
goto fail_filter_attach;
+ rc = sfc_mae_attach(sa);
+ if (rc != 0)
+ goto fail_mae_attach;
+
sfc_log_init(sa, "fini nic");
efx_nic_fini(enp);
fail_sriov_vswitch_create:
sfc_flow_fini(sa);
+ sfc_mae_detach(sa);
+
+fail_mae_attach:
sfc_filter_detach(sa);
fail_filter_attach:
sfc_flow_fini(sa);
+ sfc_mae_detach(sa);
sfc_filter_detach(sa);
sfc_rss_detach(sa);
sfc_port_detach(sa);
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright(c) 2019-2020 Xilinx, Inc.
+ * Copyright(c) 2019 Solarflare Communications Inc.
+ *
+ * This software was jointly developed between OKTET Labs (under contract
+ * for Solarflare) and Solarflare Communications, Inc.
+ */
+
+#include <stdbool.h>
+
+#include <rte_common.h>
+
+#include "efx.h"
+
+#include "sfc.h"
+#include "sfc_log.h"
+
+int
+sfc_mae_attach(struct sfc_adapter *sa)
+{
+ const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
+ struct sfc_mae *mae = &sa->mae;
+
+ sfc_log_init(sa, "entry");
+
+ if (!encp->enc_mae_supported) {
+ mae->status = SFC_MAE_STATUS_UNSUPPORTED;
+ return 0;
+ }
+
+ mae->status = SFC_MAE_STATUS_SUPPORTED;
+
+ sfc_log_init(sa, "done");
+
+ return 0;
+}
+
+void
+sfc_mae_detach(struct sfc_adapter *sa)
+{
+ struct sfc_mae *mae = &sa->mae;
+
+ sfc_log_init(sa, "entry");
+
+ mae->status = SFC_MAE_STATUS_UNKNOWN;
+
+ sfc_log_init(sa, "done");
+}
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright(c) 2019-2020 Xilinx, Inc.
+ * Copyright(c) 2019 Solarflare Communications Inc.
+ *
+ * This software was jointly developed between OKTET Labs (under contract
+ * for Solarflare) and Solarflare Communications, Inc.
+ */
+
+#ifndef _SFC_MAE_H
+#define _SFC_MAE_H
+
+#include <stdbool.h>
+
+#include "efx.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Options for MAE support status */
+enum sfc_mae_status {
+ SFC_MAE_STATUS_UNKNOWN = 0,
+ SFC_MAE_STATUS_UNSUPPORTED,
+ SFC_MAE_STATUS_SUPPORTED
+};
+
+struct sfc_mae {
+ /** NIC support for MAE status */
+ enum sfc_mae_status status;
+};
+
+struct sfc_adapter;
+
+int sfc_mae_attach(struct sfc_adapter *sa);
+void sfc_mae_detach(struct sfc_adapter *sa);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _SFC_MAE_H */