0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef EFX_COMMON_H
0012 #define EFX_COMMON_H
0013
0014 int efx_init_io(struct efx_nic *efx, int bar, dma_addr_t dma_mask,
0015 unsigned int mem_map_size);
0016 void efx_fini_io(struct efx_nic *efx);
0017 int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev);
0018 void efx_fini_struct(struct efx_nic *efx);
0019
0020 #define EFX_MAX_DMAQ_SIZE 4096UL
0021 #define EFX_DEFAULT_DMAQ_SIZE 1024UL
0022 #define EFX_MIN_DMAQ_SIZE 512UL
0023
0024 #define EFX_MAX_EVQ_SIZE 16384UL
0025 #define EFX_MIN_EVQ_SIZE 512UL
0026
0027 void efx_link_clear_advertising(struct efx_nic *efx);
0028 void efx_link_set_wanted_fc(struct efx_nic *efx, u8);
0029
0030 void efx_start_all(struct efx_nic *efx);
0031 void efx_stop_all(struct efx_nic *efx);
0032
0033 void efx_net_stats(struct net_device *net_dev, struct rtnl_link_stats64 *stats);
0034
0035 int efx_create_reset_workqueue(void);
0036 void efx_queue_reset_work(struct efx_nic *efx);
0037 void efx_flush_reset_workqueue(struct efx_nic *efx);
0038 void efx_destroy_reset_workqueue(void);
0039
0040 void efx_start_monitor(struct efx_nic *efx);
0041
0042 int __efx_reconfigure_port(struct efx_nic *efx);
0043 int efx_reconfigure_port(struct efx_nic *efx);
0044
0045 #define EFX_ASSERT_RESET_SERIALISED(efx) \
0046 do { \
0047 if ((efx)->state != STATE_UNINIT && \
0048 (efx)->state != STATE_PROBED) \
0049 ASSERT_RTNL(); \
0050 } while (0)
0051
0052 int efx_try_recovery(struct efx_nic *efx);
0053 void efx_reset_down(struct efx_nic *efx, enum reset_type method);
0054 void efx_watchdog(struct net_device *net_dev, unsigned int txqueue);
0055 int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok);
0056 int efx_reset(struct efx_nic *efx, enum reset_type method);
0057 void efx_schedule_reset(struct efx_nic *efx, enum reset_type type);
0058
0059
0060 int efx_port_dummy_op_int(struct efx_nic *efx);
0061 void efx_port_dummy_op_void(struct efx_nic *efx);
0062
0063 static inline int efx_check_disabled(struct efx_nic *efx)
0064 {
0065 if (efx->state == STATE_DISABLED || efx_recovering(efx->state)) {
0066 netif_err(efx, drv, efx->net_dev,
0067 "device is disabled due to earlier errors\n");
0068 return -EIO;
0069 }
0070 return 0;
0071 }
0072
0073 static inline void efx_schedule_channel(struct efx_channel *channel)
0074 {
0075 netif_vdbg(channel->efx, intr, channel->efx->net_dev,
0076 "channel %d scheduling NAPI poll on CPU%d\n",
0077 channel->channel, raw_smp_processor_id());
0078
0079 napi_schedule(&channel->napi_str);
0080 }
0081
0082 static inline void efx_schedule_channel_irq(struct efx_channel *channel)
0083 {
0084 channel->event_test_cpu = raw_smp_processor_id();
0085 efx_schedule_channel(channel);
0086 }
0087
0088 #ifdef CONFIG_SFC_MCDI_LOGGING
0089 void efx_init_mcdi_logging(struct efx_nic *efx);
0090 void efx_fini_mcdi_logging(struct efx_nic *efx);
0091 #else
0092 static inline void efx_init_mcdi_logging(struct efx_nic *efx) {}
0093 static inline void efx_fini_mcdi_logging(struct efx_nic *efx) {}
0094 #endif
0095
0096 void efx_mac_reconfigure(struct efx_nic *efx, bool mtu_only);
0097 int efx_set_mac_address(struct net_device *net_dev, void *data);
0098 void efx_set_rx_mode(struct net_device *net_dev);
0099 int efx_set_features(struct net_device *net_dev, netdev_features_t data);
0100 void efx_link_status_changed(struct efx_nic *efx);
0101 unsigned int efx_xdp_max_mtu(struct efx_nic *efx);
0102 int efx_change_mtu(struct net_device *net_dev, int new_mtu);
0103
0104 extern const struct pci_error_handlers efx_err_handlers;
0105
0106 netdev_features_t efx_features_check(struct sk_buff *skb, struct net_device *dev,
0107 netdev_features_t features);
0108
0109 int efx_get_phys_port_id(struct net_device *net_dev,
0110 struct netdev_phys_item_id *ppid);
0111
0112 int efx_get_phys_port_name(struct net_device *net_dev,
0113 char *name, size_t len);
0114
0115 void efx_detach_reps(struct efx_nic *efx);
0116 void efx_attach_reps(struct efx_nic *efx);
0117 #endif