gpio: rcar: Fix runtime PM imbalance on error
[linux/fpc-iii.git] / drivers / net / ethernet / sfc / efx_common.h
blobfa2fc681e7f9983330beec454d1fd37399fc4b1d
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2018 Solarflare Communications Inc.
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 */
11 #ifndef EFX_COMMON_H
12 #define EFX_COMMON_H
14 int efx_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask,
15 unsigned int mem_map_size);
16 void efx_fini_io(struct efx_nic *efx, int bar);
17 int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev,
18 struct net_device *net_dev);
19 void efx_fini_struct(struct efx_nic *efx);
21 void efx_start_all(struct efx_nic *efx);
22 void efx_stop_all(struct efx_nic *efx);
24 void efx_net_stats(struct net_device *net_dev, struct rtnl_link_stats64 *stats);
26 int efx_create_reset_workqueue(void);
27 void efx_queue_reset_work(struct efx_nic *efx);
28 void efx_flush_reset_workqueue(struct efx_nic *efx);
29 void efx_destroy_reset_workqueue(void);
31 void efx_start_monitor(struct efx_nic *efx);
33 int __efx_reconfigure_port(struct efx_nic *efx);
34 int efx_reconfigure_port(struct efx_nic *efx);
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)
44 int efx_try_recovery(struct efx_nic *efx);
45 void efx_reset_down(struct efx_nic *efx, enum reset_type method);
46 int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok);
47 int efx_reset(struct efx_nic *efx, enum reset_type method);
48 void efx_schedule_reset(struct efx_nic *efx, enum reset_type type);
50 static inline int efx_check_disabled(struct efx_nic *efx)
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;
57 return 0;
60 #ifdef CONFIG_SFC_MCDI_LOGGING
61 void efx_init_mcdi_logging(struct efx_nic *efx);
62 void efx_fini_mcdi_logging(struct efx_nic *efx);
63 #else
64 static inline void efx_init_mcdi_logging(struct efx_nic *efx) {}
65 static inline void efx_fini_mcdi_logging(struct efx_nic *efx) {}
66 #endif
68 void efx_mac_reconfigure(struct efx_nic *efx);
69 void efx_link_status_changed(struct efx_nic *efx);
70 unsigned int efx_xdp_max_mtu(struct efx_nic *efx);
71 int efx_change_mtu(struct net_device *net_dev, int new_mtu);
73 #endif