3ce654c19bf998099d25fcfe2eb226221652e837
[dpdk.git] / drivers / net / sfc / sfc_mae.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2019-2020 Xilinx, Inc.
4  * Copyright(c) 2019 Solarflare Communications Inc.
5  *
6  * This software was jointly developed between OKTET Labs (under contract
7  * for Solarflare) and Solarflare Communications, Inc.
8  */
9
10 #include <stdbool.h>
11
12 #include <rte_common.h>
13
14 #include "efx.h"
15
16 #include "sfc.h"
17 #include "sfc_log.h"
18
19 int
20 sfc_mae_attach(struct sfc_adapter *sa)
21 {
22         const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
23         struct sfc_mae *mae = &sa->mae;
24
25         sfc_log_init(sa, "entry");
26
27         if (!encp->enc_mae_supported) {
28                 mae->status = SFC_MAE_STATUS_UNSUPPORTED;
29                 return 0;
30         }
31
32         mae->status = SFC_MAE_STATUS_SUPPORTED;
33
34         sfc_log_init(sa, "done");
35
36         return 0;
37 }
38
39 void
40 sfc_mae_detach(struct sfc_adapter *sa)
41 {
42         struct sfc_mae *mae = &sa->mae;
43
44         sfc_log_init(sa, "entry");
45
46         mae->status = SFC_MAE_STATUS_UNKNOWN;
47
48         sfc_log_init(sa, "done");
49 }