File Index
Files and directories
Sign in
FILE

mcdi_port.c

File preview with syntax highlighting.

linux-6.19.14/drivers/net/ethernet/sfc/mcdi_port.c C
 1// SPDX-License-Identifier: GPL-2.0-only
 2/****************************************************************************
 3 * Driver for Solarflare network controllers and boards
 4 * Copyright 2009-2013 Solarflare Communications Inc.
 5 */
 6
 7/*
 8 * Driver for PHY related operations via MCDI.
 9 */
10
11#include <linux/slab.h>
12#include "efx.h"
13#include "mcdi_port.h"
14#include "mcdi.h"
15#include "mcdi_pcol.h"
16#include "nic.h"
17#include "selftest.h"
18#include "mcdi_port_common.h"
19
20
21u32 efx_mcdi_phy_get_caps(struct efx_nic *efx)
22{
23	struct efx_mcdi_phy_data *phy_data = efx->phy_data;
24
25	return phy_data->supported_cap;
26}
27
28bool efx_mcdi_mac_check_fault(struct efx_nic *efx)
29{
30	MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_LINK_OUT_LEN);
31	size_t outlength;
32	int rc;
33
34	BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0);
35
36	rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0,
37			  outbuf, sizeof(outbuf), &outlength);
38	if (rc)
39		return true;
40
41	return MCDI_DWORD(outbuf, GET_LINK_OUT_MAC_FAULT) != 0;
42}
43
44int efx_mcdi_port_probe(struct efx_nic *efx)
45{
46	int rc;
47
48	/* Fill out loopback modes and initial link state */
49	rc = efx_mcdi_phy_probe(efx);
50	if (rc != 0)
51		return rc;
52
53	return efx_mcdi_mac_init_stats(efx);
54}
55
56void efx_mcdi_port_remove(struct efx_nic *efx)
57{
58	efx_mcdi_phy_remove(efx);
59	efx_mcdi_mac_fini_stats(efx);
60}
~/ Read-only file preview.