#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <linux/swab.h>
#include <linux/dma-mapping.h>
#include <linux/if_vlan.h>
#include <net/ip.h>
#include <linux/ipv6.h>
#include <linux/inetdevice.h>
#include <linux/log2.h>
#include <linux/pci.h>
#include <net/vxlan.h>
#include "qlcnic.h"
#include "qlcnic_sriov.h"
#include "qlcnic_hw.h"
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_VERSION(…);
MODULE_FIRMWARE(…);
char qlcnic_driver_name[] = …;
static const char qlcnic_driver_string[] = …;
static int qlcnic_mac_learn;
module_param(qlcnic_mac_learn, int, 0444);
MODULE_PARM_DESC(…) …;
int qlcnic_use_msi = …;
MODULE_PARM_DESC(…) …;
module_param_named(use_msi, qlcnic_use_msi, int, 0444);
int qlcnic_use_msi_x = …;
MODULE_PARM_DESC(…) …;
module_param_named(use_msi_x, qlcnic_use_msi_x, int, 0444);
int qlcnic_auto_fw_reset = …;
MODULE_PARM_DESC(…) …;
module_param_named(auto_fw_reset, qlcnic_auto_fw_reset, int, 0644);
int qlcnic_load_fw_file;
MODULE_PARM_DESC(…) …;
module_param_named(load_fw_file, qlcnic_load_fw_file, int, 0444);
static int qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static void qlcnic_remove(struct pci_dev *pdev);
static int qlcnic_open(struct net_device *netdev);
static int qlcnic_close(struct net_device *netdev);
static void qlcnic_tx_timeout(struct net_device *netdev, unsigned int txqueue);
static void qlcnic_attach_work(struct work_struct *work);
static void qlcnic_fwinit_work(struct work_struct *work);
static void qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding);
static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter);
static irqreturn_t qlcnic_tmp_intr(int irq, void *data);
static irqreturn_t qlcnic_intr(int irq, void *data);
static irqreturn_t qlcnic_msi_intr(int irq, void *data);
static irqreturn_t qlcnic_msix_intr(int irq, void *data);
static irqreturn_t qlcnic_msix_tx_intr(int irq, void *data);
static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev);
static int qlcnic_start_firmware(struct qlcnic_adapter *);
static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter);
static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *);
static int qlcnicvf_start_firmware(struct qlcnic_adapter *);
static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16);
static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16);
static int qlcnic_82xx_setup_intr(struct qlcnic_adapter *);
static void qlcnic_82xx_dev_request_reset(struct qlcnic_adapter *, u32);
static irqreturn_t qlcnic_82xx_clear_legacy_intr(struct qlcnic_adapter *);
static pci_ers_result_t qlcnic_82xx_io_slot_reset(struct pci_dev *);
static int qlcnic_82xx_start_firmware(struct qlcnic_adapter *);
static void qlcnic_82xx_io_resume(struct pci_dev *);
static void qlcnic_82xx_set_mac_filter_count(struct qlcnic_adapter *);
static pci_ers_result_t qlcnic_82xx_io_error_detected(struct pci_dev *,
pci_channel_state_t);
static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter)
{ … }
#define ENTRY(device) …
static const struct pci_device_id qlcnic_pci_tbl[] = …;
MODULE_DEVICE_TABLE(pci, qlcnic_pci_tbl);
inline void qlcnic_update_cmd_producer(struct qlcnic_host_tx_ring *tx_ring)
{ … }
static const u32 msi_tgt_status[8] = …;
static const u32 qlcnic_reg_tbl[] = …;
static const struct qlcnic_board_info qlcnic_boards[] = …;
#define NUM_SUPPORTED_BOARDS …
static const
struct qlcnic_legacy_intr_set legacy_intr[] = …;
int qlcnic_alloc_sds_rings(struct qlcnic_recv_context *recv_ctx, int count)
{ … }
void qlcnic_free_sds_rings(struct qlcnic_recv_context *recv_ctx)
{ … }
int qlcnic_read_mac_addr(struct qlcnic_adapter *adapter)
{ … }
static void qlcnic_delete_adapter_mac(struct qlcnic_adapter *adapter)
{ … }
static int qlcnic_set_mac(struct net_device *netdev, void *p)
{ … }
static int qlcnic_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
struct net_device *netdev,
const unsigned char *addr, u16 vid,
struct netlink_ext_ack *extack)
{ … }
static int qlcnic_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
struct net_device *netdev,
const unsigned char *addr, u16 vid, u16 flags,
struct netlink_ext_ack *extack)
{ … }
static int qlcnic_fdb_dump(struct sk_buff *skb, struct netlink_callback *ncb,
struct net_device *netdev,
struct net_device *filter_dev, int *idx)
{ … }
static void qlcnic_82xx_cancel_idc_work(struct qlcnic_adapter *adapter)
{ … }
static int qlcnic_get_phys_port_id(struct net_device *netdev,
struct netdev_phys_item_id *ppid)
{ … }
static int qlcnic_udp_tunnel_sync(struct net_device *dev, unsigned int table)
{ … }
static const struct udp_tunnel_nic_info qlcnic_udp_tunnels = …;
static netdev_features_t qlcnic_features_check(struct sk_buff *skb,
struct net_device *dev,
netdev_features_t features)
{ … }
static const struct net_device_ops qlcnic_netdev_ops = …;
static const struct net_device_ops qlcnic_netdev_failed_ops = …;
static struct qlcnic_nic_template qlcnic_ops = …;
struct qlcnic_nic_template qlcnic_vf_ops = …;
static struct qlcnic_hardware_ops qlcnic_hw_ops = …;
static int qlcnic_check_multi_tx_capability(struct qlcnic_adapter *adapter)
{ … }
static int qlcnic_max_rings(struct qlcnic_adapter *adapter, u8 ring_cnt,
int queue_type)
{ … }
void qlcnic_set_tx_ring_count(struct qlcnic_adapter *adapter, u8 tx_cnt)
{ … }
void qlcnic_set_sds_ring_count(struct qlcnic_adapter *adapter, u8 rx_cnt)
{ … }
int qlcnic_setup_tss_rss_intr(struct qlcnic_adapter *adapter)
{ … }
int qlcnic_enable_msix(struct qlcnic_adapter *adapter, u32 num_msix)
{ … }
static int qlcnic_82xx_calculate_msix_vector(struct qlcnic_adapter *adapter)
{ … }
static int qlcnic_enable_msi_legacy(struct qlcnic_adapter *adapter)
{ … }
static int qlcnic_82xx_setup_intr(struct qlcnic_adapter *adapter)
{ … }
int qlcnic_82xx_mq_intrpt(struct qlcnic_adapter *adapter, int op_type)
{ … }
void qlcnic_teardown_intr(struct qlcnic_adapter *adapter)
{ … }
static void qlcnic_cleanup_pci_map(struct qlcnic_hardware_context *ahw)
{ … }
static int qlcnic_get_act_pci_func(struct qlcnic_adapter *adapter)
{ … }
static bool qlcnic_port_eswitch_cfg_capability(struct qlcnic_adapter *adapter)
{ … }
int qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
{ … }
static int
qlcnic_set_function_modes(struct qlcnic_adapter *adapter)
{ … }
static void qlcnic_check_vf(struct qlcnic_adapter *adapter,
const struct pci_device_id *ent)
{ … }
#define QLCNIC_82XX_BAR0_LENGTH …
#define QLCNIC_83XX_BAR0_LENGTH …
static void qlcnic_get_bar_length(u32 dev_id, ulong *bar)
{ … }
static int qlcnic_setup_pci_map(struct pci_dev *pdev,
struct qlcnic_hardware_context *ahw)
{ … }
static bool qlcnic_validate_subsystem_id(struct qlcnic_adapter *adapter,
int index)
{ … }
static void qlcnic_get_board_name(struct qlcnic_adapter *adapter, char *name)
{ … }
static void
qlcnic_check_options(struct qlcnic_adapter *adapter)
{ … }
static int
qlcnic_initialize_nic(struct qlcnic_adapter *adapter)
{ … }
void qlcnic_set_vlan_config(struct qlcnic_adapter *adapter,
struct qlcnic_esw_func_cfg *esw_cfg)
{ … }
static int
qlcnic_vlan_rx_add(struct net_device *netdev, __be16 proto, u16 vid)
{ … }
static int
qlcnic_vlan_rx_del(struct net_device *netdev, __be16 proto, u16 vid)
{ … }
void qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter,
struct qlcnic_esw_func_cfg *esw_cfg)
{ … }
int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter)
{ … }
void qlcnic_set_netdev_features(struct qlcnic_adapter *adapter,
struct qlcnic_esw_func_cfg *esw_cfg)
{ … }
static int
qlcnic_check_eswitch_mode(struct qlcnic_adapter *adapter)
{ … }
int qlcnic_set_default_offload_settings(struct qlcnic_adapter *adapter)
{ … }
static int
qlcnic_reset_eswitch_config(struct qlcnic_adapter *adapter,
struct qlcnic_npar_info *npar, int pci_func)
{ … }
int qlcnic_reset_npar_config(struct qlcnic_adapter *adapter)
{ … }
static int qlcnic_check_npar_opertional(struct qlcnic_adapter *adapter)
{ … }
static int
qlcnic_set_mgmt_operations(struct qlcnic_adapter *adapter)
{ … }
static int qlcnic_82xx_start_firmware(struct qlcnic_adapter *adapter)
{ … }
static int
qlcnic_request_irq(struct qlcnic_adapter *adapter)
{ … }
static void
qlcnic_free_irq(struct qlcnic_adapter *adapter)
{ … }
static void qlcnic_get_lro_mss_capability(struct qlcnic_adapter *adapter)
{ … }
static int qlcnic_config_def_intr_coalesce(struct qlcnic_adapter *adapter)
{ … }
int __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev)
{ … }
int qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev)
{ … }
void __qlcnic_down(struct qlcnic_adapter *adapter, struct net_device *netdev)
{ … }
void qlcnic_down(struct qlcnic_adapter *adapter, struct net_device *netdev)
{ … }
int
qlcnic_attach(struct qlcnic_adapter *adapter)
{ … }
void qlcnic_detach(struct qlcnic_adapter *adapter)
{ … }
void qlcnic_diag_free_res(struct net_device *netdev, int drv_sds_rings)
{ … }
static int qlcnic_alloc_adapter_resources(struct qlcnic_adapter *adapter)
{ … }
static void qlcnic_free_adapter_resources(struct qlcnic_adapter *adapter)
{ … }
int qlcnic_diag_alloc_res(struct net_device *netdev, int test)
{ … }
static int
qlcnic_reset_hw_context(struct qlcnic_adapter *adapter)
{ … }
int
qlcnic_reset_context(struct qlcnic_adapter *adapter)
{ … }
static void qlcnic_82xx_set_mac_filter_count(struct qlcnic_adapter *adapter)
{ … }
static int qlcnic_set_real_num_queues(struct qlcnic_adapter *adapter,
u8 tx_queues, u8 rx_queues)
{ … }
int
qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev)
{ … }
void qlcnic_free_tx_rings(struct qlcnic_adapter *adapter)
{ … }
int qlcnic_alloc_tx_rings(struct qlcnic_adapter *adapter,
struct net_device *netdev)
{ … }
void qlcnic_set_drv_version(struct qlcnic_adapter *adapter)
{ … }
static void qlcnic_reset_api_lock(struct qlcnic_adapter *adapter)
{ … }
static int
qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ … }
static void qlcnic_remove(struct pci_dev *pdev)
{ … }
static void qlcnic_shutdown(struct pci_dev *pdev)
{ … }
static int __maybe_unused qlcnic_suspend(struct device *dev_d)
{ … }
static int __maybe_unused qlcnic_resume(struct device *dev_d)
{ … }
static int qlcnic_open(struct net_device *netdev)
{ … }
static int qlcnic_close(struct net_device *netdev)
{ … }
#define QLCNIC_VF_LB_BUCKET_SIZE …
void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter)
{ … }
static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter)
{ … }
int qlcnic_check_temp(struct qlcnic_adapter *adapter)
{ … }
static inline void dump_tx_ring_desc(struct qlcnic_host_tx_ring *tx_ring)
{ … }
static void qlcnic_dump_rings(struct qlcnic_adapter *adapter)
{ … }
static void qlcnic_tx_timeout(struct net_device *netdev, unsigned int txqueue)
{ … }
static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev)
{ … }
static irqreturn_t qlcnic_82xx_clear_legacy_intr(struct qlcnic_adapter *adapter)
{ … }
static irqreturn_t qlcnic_tmp_intr(int irq, void *data)
{ … }
static irqreturn_t qlcnic_intr(int irq, void *data)
{ … }
static irqreturn_t qlcnic_msi_intr(int irq, void *data)
{ … }
static irqreturn_t qlcnic_msix_intr(int irq, void *data)
{ … }
static irqreturn_t qlcnic_msix_tx_intr(int irq, void *data)
{ … }
static void
qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding)
{ … }
static int
qlcnic_set_drv_state(struct qlcnic_adapter *adapter, u8 state)
{ … }
static int
qlcnic_clr_drv_state(struct qlcnic_adapter *adapter)
{ … }
void qlcnic_clr_all_drv_state(struct qlcnic_adapter *adapter, u8 failed)
{ … }
static int
qlcnic_check_drv_state(struct qlcnic_adapter *adapter)
{ … }
static int qlcnic_check_idc_ver(struct qlcnic_adapter *adapter)
{ … }
static int
qlcnic_can_start_firmware(struct qlcnic_adapter *adapter)
{ … }
static void
qlcnic_fwinit_work(struct work_struct *work)
{ … }
static void
qlcnic_detach_work(struct work_struct *work)
{ … }
static void
qlcnic_set_npar_non_operational(struct qlcnic_adapter *adapter)
{ … }
static void qlcnic_82xx_dev_request_reset(struct qlcnic_adapter *adapter,
u32 key)
{ … }
static void
qlcnic_dev_set_npar_ready(struct qlcnic_adapter *adapter)
{ … }
void qlcnic_schedule_work(struct qlcnic_adapter *adapter,
work_func_t func, int delay)
{ … }
static void
qlcnic_attach_work(struct work_struct *work)
{ … }
static int
qlcnic_check_health(struct qlcnic_adapter *adapter)
{ … }
void qlcnic_fw_poll_work(struct work_struct *work)
{ … }
static int qlcnic_is_first_func(struct pci_dev *pdev)
{ … }
static int qlcnic_attach_func(struct pci_dev *pdev)
{ … }
static pci_ers_result_t qlcnic_82xx_io_error_detected(struct pci_dev *pdev,
pci_channel_state_t state)
{ … }
static pci_ers_result_t qlcnic_82xx_io_slot_reset(struct pci_dev *pdev)
{ … }
static void qlcnic_82xx_io_resume(struct pci_dev *pdev)
{ … }
static pci_ers_result_t qlcnic_io_error_detected(struct pci_dev *pdev,
pci_channel_state_t state)
{ … }
static pci_ers_result_t qlcnic_io_slot_reset(struct pci_dev *pdev)
{ … }
static void qlcnic_io_resume(struct pci_dev *pdev)
{ … }
static int
qlcnicvf_start_firmware(struct qlcnic_adapter *adapter)
{ … }
int qlcnic_validate_rings(struct qlcnic_adapter *adapter, __u32 ring_cnt,
int queue_type)
{ … }
int qlcnic_setup_rings(struct qlcnic_adapter *adapter)
{ … }
#ifdef CONFIG_INET
#define is_qlcnic_netdev(dev) …
static void
qlcnic_config_indev_addr(struct qlcnic_adapter *adapter,
struct net_device *dev, unsigned long event)
{ … }
void qlcnic_restore_indev_addr(struct net_device *netdev, unsigned long event)
{ … }
static int qlcnic_netdev_event(struct notifier_block *this,
unsigned long event, void *ptr)
{ … }
static int
qlcnic_inetaddr_event(struct notifier_block *this,
unsigned long event, void *ptr)
{ … }
static struct notifier_block qlcnic_netdev_cb = …;
static struct notifier_block qlcnic_inetaddr_cb = …;
#else
void qlcnic_restore_indev_addr(struct net_device *dev, unsigned long event)
{ }
#endif
static const struct pci_error_handlers qlcnic_err_handler = …;
static SIMPLE_DEV_PM_OPS(qlcnic_pm_ops, qlcnic_suspend, qlcnic_resume);
static struct pci_driver qlcnic_driver = …;
static int __init qlcnic_init_module(void)
{ … }
module_init(…) …;
static void __exit qlcnic_exit_module(void)
{ … }
module_exit(qlcnic_exit_module);