Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* 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
11#ifndef EFX_COMMON_H
12#define EFX_COMMON_H
13
14int efx_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask,
15 unsigned int mem_map_size);
16void efx_fini_io(struct efx_nic *efx, int bar);
17int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev,
18 struct net_device *net_dev);
19void efx_fini_struct(struct efx_nic *efx);
20
21void efx_start_all(struct efx_nic *efx);
22void efx_stop_all(struct efx_nic *efx);
23
24void efx_net_stats(struct net_device *net_dev, struct rtnl_link_stats64 *stats);
25
26int efx_create_reset_workqueue(void);
27void efx_queue_reset_work(struct efx_nic *efx);
28void efx_flush_reset_workqueue(struct efx_nic *efx);
29void efx_destroy_reset_workqueue(void);
30
31void efx_start_monitor(struct efx_nic *efx);
32
33int __efx_reconfigure_port(struct efx_nic *efx);
34int efx_reconfigure_port(struct efx_nic *efx);
35
36#define EFX_ASSERT_RESET_SERIALISED(efx) \
37 do { \
38 if ((efx->state == STATE_READY) || \
39 (efx->state == STATE_RECOVERY) || \
40 (efx->state == STATE_DISABLED)) \
41 ASSERT_RTNL(); \
42 } while (0)
43
44int efx_try_recovery(struct efx_nic *efx);
45void efx_reset_down(struct efx_nic *efx, enum reset_type method);
46int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok);
47int efx_reset(struct efx_nic *efx, enum reset_type method);
48void efx_schedule_reset(struct efx_nic *efx, enum reset_type type);
49
50static inline int efx_check_disabled(struct efx_nic *efx)
51{
52 if (efx->state == STATE_DISABLED || efx->state == STATE_RECOVERY) {
53 netif_err(efx, drv, efx->net_dev,
54 "device is disabled due to earlier errors\n");
55 return -EIO;
56 }
57 return 0;
58}
59
60#ifdef CONFIG_SFC_MCDI_LOGGING
61void efx_init_mcdi_logging(struct efx_nic *efx);
62void efx_fini_mcdi_logging(struct efx_nic *efx);
63#else
64static inline void efx_init_mcdi_logging(struct efx_nic *efx) {}
65static inline void efx_fini_mcdi_logging(struct efx_nic *efx) {}
66#endif
67
68void efx_mac_reconfigure(struct efx_nic *efx);
69void efx_link_status_changed(struct efx_nic *efx);
70unsigned int efx_xdp_max_mtu(struct efx_nic *efx);
71int efx_change_mtu(struct net_device *net_dev, int new_mtu);
72
73#endif