From: Ivan Malov <ivan.malov@oktetlabs.ru>
Add a stub for MAE attach / detach path and introduce MAE-specific context.
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
drivers/net/sfc/meson.build | 1 +
drivers/net/sfc/sfc.c | 8 ++++++
drivers/net/sfc/sfc.h | 2 ++
drivers/net/sfc/sfc_mae.c | 49 +++++++++++++++++++++++++++++++++++++
drivers/net/sfc/sfc_mae.h | 41 +++++++++++++++++++++++++++++++
5 files changed, 101 insertions(+)
create mode 100644 drivers/net/sfc/sfc_mae.c
create mode 100644 drivers/net/sfc/sfc_mae.h
@@ -47,6 +47,7 @@ sources = files(
'sfc_tx.c',
'sfc_tso.c',
'sfc_filter.c',
+ 'sfc_mae.c',
'sfc_flow.c',
'sfc_dp.c',
'sfc_ef10_rx.c',
@@ -857,6 +857,10 @@ sfc_attach(struct sfc_adapter *sa)
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);
@@ -878,6 +882,9 @@ sfc_attach(struct sfc_adapter *sa)
fail_sriov_vswitch_create:
sfc_flow_fini(sa);
+ sfc_mae_detach(sa);
+
+fail_mae_attach:
sfc_filter_detach(sa);
fail_filter_attach:
@@ -918,6 +925,7 @@ sfc_detach(struct sfc_adapter *sa)
sfc_flow_fini(sa);
+ sfc_mae_detach(sa);
sfc_filter_detach(sa);
sfc_rss_detach(sa);
sfc_port_detach(sa);
@@ -27,6 +27,7 @@
#include "sfc_log.h"
#include "sfc_filter.h"
#include "sfc_sriov.h"
+#include "sfc_mae.h"
#ifdef __cplusplus
extern "C" {
@@ -233,6 +234,7 @@ struct sfc_adapter {
struct sfc_intr intr;
struct sfc_port port;
struct sfc_filter filter;
+ struct sfc_mae mae;
struct sfc_flow_list flow_list;
new file mode 100644
@@ -0,0 +1,49 @@
+/* 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");
+}
new file mode 100644
@@ -0,0 +1,41 @@
+/* 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 */