blob: b16f11265269891d99ed6cc57abfade670e2d22a [file] [log] [blame]
Alex Maftei (amaftei)e1253f32020-01-08 16:10:32 +00001/* SPDX-License-Identifier: GPL-2.0-only */
2/****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2018 Solarflare Communications Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation, incorporated herein by reference.
9 */
10#ifndef EFX_MCDI_PORT_COMMON_H
11#define EFX_MCDI_PORT_COMMON_H
12
13#include "net_driver.h"
14#include "mcdi.h"
15#include "mcdi_pcol.h"
16
17struct efx_mcdi_phy_data {
18 u32 flags;
19 u32 type;
20 u32 supported_cap;
21 u32 channel;
22 u32 port;
23 u32 stats_mask;
24 u8 name[20];
25 u32 media;
26 u32 mmd_mask;
27 u8 revision[20];
28 u32 forced_cap;
29};
30
Alex Maftei (amaftei)190c7362020-01-10 13:27:17 +000031#define EFX_MC_STATS_GENERATION_INVALID ((__force __le64)(-1))
32
Alex Maftei (amaftei)e1253f32020-01-08 16:10:32 +000033int efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_data *cfg);
34void efx_link_set_advertising(struct efx_nic *efx,
35 const unsigned long *advertising);
36int efx_mcdi_set_link(struct efx_nic *efx, u32 capabilities,
37 u32 flags, u32 loopback_mode, u32 loopback_speed);
38int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes);
39void mcdi_to_ethtool_linkset(u32 media, u32 cap, unsigned long *linkset);
40u32 ethtool_linkset_to_mcdi_cap(const unsigned long *linkset);
41u32 efx_get_mcdi_phy_flags(struct efx_nic *efx);
42u8 mcdi_to_ethtool_media(u32 media);
43void efx_mcdi_phy_decode_link(struct efx_nic *efx,
44 struct efx_link_state *link_state,
45 u32 speed, u32 flags, u32 fcntl);
46u32 ethtool_fec_caps_to_mcdi(u32 ethtool_cap);
47u32 mcdi_fec_caps_to_ethtool(u32 caps, bool is_25g);
48void efx_mcdi_phy_check_fcntl(struct efx_nic *efx, u32 lpa);
49bool efx_mcdi_phy_poll(struct efx_nic *efx);
50int efx_mcdi_phy_get_fecparam(struct efx_nic *efx,
51 struct ethtool_fecparam *fec);
52int efx_mcdi_phy_test_alive(struct efx_nic *efx);
Alex Maftei (amaftei)190c7362020-01-10 13:27:17 +000053int efx_mcdi_set_mac(struct efx_nic *efx);
Alex Maftei (amaftei)e1253f32020-01-08 16:10:32 +000054int efx_mcdi_port_get_number(struct efx_nic *efx);
Alex Maftei (amaftei)88f7df32020-01-10 13:27:50 +000055void efx_mcdi_process_link_change(struct efx_nic *efx, efx_qword_t *ev);
Alex Maftei (amaftei)e1253f32020-01-08 16:10:32 +000056
57#endif