net/sfc: add stub for attaching to MAE

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>
This commit is contained in:
Ivan Malov 2020-10-20 10:12:43 +01:00 committed by Ferruh Yigit
parent eb4e80085f
commit 02b234adde
5 changed files with 101 additions and 0 deletions

View File

@ -47,6 +47,7 @@ sources = files(
'sfc_tx.c', 'sfc_tx.c',
'sfc_tso.c', 'sfc_tso.c',
'sfc_filter.c', 'sfc_filter.c',
'sfc_mae.c',
'sfc_flow.c', 'sfc_flow.c',
'sfc_dp.c', 'sfc_dp.c',
'sfc_ef10_rx.c', 'sfc_ef10_rx.c',

View File

@ -857,6 +857,10 @@ sfc_attach(struct sfc_adapter *sa)
if (rc != 0) if (rc != 0)
goto fail_filter_attach; goto fail_filter_attach;
rc = sfc_mae_attach(sa);
if (rc != 0)
goto fail_mae_attach;
sfc_log_init(sa, "fini nic"); sfc_log_init(sa, "fini nic");
efx_nic_fini(enp); efx_nic_fini(enp);
@ -878,6 +882,9 @@ sfc_attach(struct sfc_adapter *sa)
fail_sriov_vswitch_create: fail_sriov_vswitch_create:
sfc_flow_fini(sa); sfc_flow_fini(sa);
sfc_mae_detach(sa);
fail_mae_attach:
sfc_filter_detach(sa); sfc_filter_detach(sa);
fail_filter_attach: fail_filter_attach:
@ -918,6 +925,7 @@ sfc_detach(struct sfc_adapter *sa)
sfc_flow_fini(sa); sfc_flow_fini(sa);
sfc_mae_detach(sa);
sfc_filter_detach(sa); sfc_filter_detach(sa);
sfc_rss_detach(sa); sfc_rss_detach(sa);
sfc_port_detach(sa); sfc_port_detach(sa);

View File

@ -27,6 +27,7 @@
#include "sfc_log.h" #include "sfc_log.h"
#include "sfc_filter.h" #include "sfc_filter.h"
#include "sfc_sriov.h" #include "sfc_sriov.h"
#include "sfc_mae.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -233,6 +234,7 @@ struct sfc_adapter {
struct sfc_intr intr; struct sfc_intr intr;
struct sfc_port port; struct sfc_port port;
struct sfc_filter filter; struct sfc_filter filter;
struct sfc_mae mae;
struct sfc_flow_list flow_list; struct sfc_flow_list flow_list;

49
drivers/net/sfc/sfc_mae.c Normal file
View File

@ -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");
}

41
drivers/net/sfc/sfc_mae.h Normal file
View File

@ -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 */