[03/62] net/sfc: add a stub for attaching to MAE
diff mbox series

Message ID 1603183709-23420-4-git-send-email-arybchenko@solarflare.com
State Superseded, archived
Headers show
Series
  • net/sfc: support flow API transfer rules
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Oct. 20, 2020, 8:47 a.m. UTC
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

Patch
diff mbox series

diff --git a/drivers/net/sfc/meson.build b/drivers/net/sfc/meson.build
index 589f7863ae..7a893080cb 100644
--- a/drivers/net/sfc/meson.build
+++ b/drivers/net/sfc/meson.build
@@ -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',
diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c
index 8fa790da55..3b896490f7 100644
--- a/drivers/net/sfc/sfc.c
+++ b/drivers/net/sfc/sfc.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);
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 047ca64de7..4b5d687108 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -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;
 
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
new file mode 100644
index 0000000000..3ce654c19b
--- /dev/null
+++ b/drivers/net/sfc/sfc_mae.c
@@ -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");
+}
diff --git a/drivers/net/sfc/sfc_mae.h b/drivers/net/sfc/sfc_mae.h
new file mode 100644
index 0000000000..d7821e71cc
--- /dev/null
+++ b/drivers/net/sfc/sfc_mae.h
@@ -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 */