linux/drivers/net/ethernet/huawei/hinic/hinic_main.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Huawei HiNIC PCI Express Linux driver
 * Copyright(c) 2017 Huawei Technologies Co., Ltd
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/pci.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/etherdevice.h>
#include <linux/netdevice.h>
#include <linux/slab.h>
#include <linux/if_vlan.h>
#include <linux/semaphore.h>
#include <linux/workqueue.h>
#include <net/ip.h>
#include <net/devlink.h>
#include <linux/bitops.h>
#include <linux/bitmap.h>
#include <linux/delay.h>
#include <linux/err.h>

#include "hinic_debugfs.h"
#include "hinic_hw_qp.h"
#include "hinic_hw_dev.h"
#include "hinic_devlink.h"
#include "hinic_port.h"
#include "hinic_tx.h"
#include "hinic_rx.h"
#include "hinic_dev.h"
#include "hinic_sriov.h"

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

static unsigned int tx_weight =;
module_param(tx_weight, uint, 0644);
MODULE_PARM_DESC();

static unsigned int rx_weight =;
module_param(rx_weight, uint, 0644);
MODULE_PARM_DESC();

#define HINIC_DEV_ID_QUAD_PORT_25GE
#define HINIC_DEV_ID_DUAL_PORT_100GE
#define HINIC_DEV_ID_DUAL_PORT_100GE_MEZZ
#define HINIC_DEV_ID_QUAD_PORT_25GE_MEZZ
#define HINIC_DEV_ID_VF

#define HINIC_WQ_NAME

#define MSG_ENABLE_DEFAULT

#define HINIC_LRO_MAX_WQE_NUM_DEFAULT

#define HINIC_LRO_RX_TIMER_DEFAULT

#define work_to_rx_mode_work(work)

#define rx_mode_work_to_nic_dev(rx_mode_work)

#define HINIC_WAIT_SRIOV_CFG_TIMEOUT

#define HINIC_DEAULT_TXRX_MSIX_PENDING_LIMIT
#define HINIC_DEAULT_TXRX_MSIX_COALESC_TIMER_CFG
#define HINIC_DEAULT_TXRX_MSIX_RESEND_TIMER_CFG

static int change_mac_addr(struct net_device *netdev, const u8 *addr);

static int set_features(struct hinic_dev *nic_dev,
			netdev_features_t pre_features,
			netdev_features_t features, bool force_change);

static void gather_rx_stats(struct hinic_rxq_stats *nic_rx_stats, struct hinic_rxq *rxq)
{}

static void gather_tx_stats(struct hinic_txq_stats *nic_tx_stats, struct hinic_txq *txq)
{}

static void gather_nic_stats(struct hinic_dev *nic_dev,
			     struct hinic_rxq_stats *nic_rx_stats,
			     struct hinic_txq_stats *nic_tx_stats)
{}

/**
 * create_txqs - Create the Logical Tx Queues of specific NIC device
 * @nic_dev: the specific NIC device
 *
 * Return 0 - Success, negative - Failure
 **/
static int create_txqs(struct hinic_dev *nic_dev)
{}

static void enable_txqs_napi(struct hinic_dev *nic_dev)
{}

static void disable_txqs_napi(struct hinic_dev *nic_dev)
{}

/**
 * free_txqs - Free the Logical Tx Queues of specific NIC device
 * @nic_dev: the specific NIC device
 **/
static void free_txqs(struct hinic_dev *nic_dev)
{}

/**
 * create_rxqs - Create the Logical Rx Queues of specific NIC device
 * @nic_dev: the specific NIC device
 *
 * Return 0 - Success, negative - Failure
 **/
static int create_rxqs(struct hinic_dev *nic_dev)
{}

/**
 * free_rxqs - Free the Logical Rx Queues of specific NIC device
 * @nic_dev: the specific NIC device
 **/
static void free_rxqs(struct hinic_dev *nic_dev)
{}

static int hinic_configure_max_qnum(struct hinic_dev *nic_dev)
{}

static int hinic_rss_init(struct hinic_dev *nic_dev)
{}

static void hinic_rss_deinit(struct hinic_dev *nic_dev)
{}

static void hinic_init_rss_parameters(struct hinic_dev *nic_dev)
{}

static void hinic_enable_rss(struct hinic_dev *nic_dev)
{}

int hinic_open(struct net_device *netdev)
{}

int hinic_close(struct net_device *netdev)
{}

static int hinic_change_mtu(struct net_device *netdev, int new_mtu)
{}

/**
 * change_mac_addr - change the main mac address of network device
 * @netdev: network device
 * @addr: mac address to set
 *
 * Return 0 - Success, negative - Failure
 **/
static int change_mac_addr(struct net_device *netdev, const u8 *addr)
{}

static int hinic_set_mac_addr(struct net_device *netdev, void *addr)
{}

/**
 * add_mac_addr - add mac address to network device
 * @netdev: network device
 * @addr: mac address to add
 *
 * Return 0 - Success, negative - Failure
 **/
static int add_mac_addr(struct net_device *netdev, const u8 *addr)
{}

/**
 * remove_mac_addr - remove mac address from network device
 * @netdev: network device
 * @addr: mac address to remove
 *
 * Return 0 - Success, negative - Failure
 **/
static int remove_mac_addr(struct net_device *netdev, const u8 *addr)
{}

static int hinic_vlan_rx_add_vid(struct net_device *netdev,
				 __always_unused __be16 proto, u16 vid)
{}

static int hinic_vlan_rx_kill_vid(struct net_device *netdev,
				  __always_unused __be16 proto, u16 vid)
{}

static void set_rx_mode(struct work_struct *work)
{}

static void hinic_set_rx_mode(struct net_device *netdev)
{}

static void hinic_tx_timeout(struct net_device *netdev, unsigned int txqueue)
{}

static void hinic_get_stats64(struct net_device *netdev,
			      struct rtnl_link_stats64 *stats)
{}

static int hinic_set_features(struct net_device *netdev,
			      netdev_features_t features)
{}

static netdev_features_t hinic_fix_features(struct net_device *netdev,
					    netdev_features_t features)
{}

static const struct net_device_ops hinic_netdev_ops =;

static const struct net_device_ops hinicvf_netdev_ops =;

static void netdev_features_init(struct net_device *netdev)
{}

static void hinic_refresh_nic_cfg(struct hinic_dev *nic_dev)
{}

/**
 * link_status_event_handler - link event handler
 * @handle: nic device for the handler
 * @buf_in: input buffer
 * @in_size: input size
 * @buf_out: output buffer
 * @out_size: returned output size
 **/
static void link_status_event_handler(void *handle, void *buf_in, u16 in_size,
				      void *buf_out, u16 *out_size)
{}

static void cable_plug_event(void *handle,
			     void *buf_in, u16 in_size,
			     void *buf_out, u16 *out_size)
{}

static void link_err_event(void *handle,
			   void *buf_in, u16 in_size,
			   void *buf_out, u16 *out_size)
{}

static int set_features(struct hinic_dev *nic_dev,
			netdev_features_t pre_features,
			netdev_features_t features, bool force_change)
{}

static int hinic_init_intr_coalesce(struct hinic_dev *nic_dev)
{}

static void hinic_free_intr_coalesce(struct hinic_dev *nic_dev)
{}

/**
 * nic_dev_init - Initialize the NIC device
 * @pdev: the NIC pci device
 *
 * Return 0 - Success, negative - Failure
 **/
static int nic_dev_init(struct pci_dev *pdev)
{}

static int hinic_probe(struct pci_dev *pdev,
		       const struct pci_device_id *id)
{}

static void wait_sriov_cfg_complete(struct hinic_dev *nic_dev)
{}

static void hinic_remove(struct pci_dev *pdev)
{}

static void hinic_shutdown(struct pci_dev *pdev)
{}

static const struct pci_device_id hinic_pci_table[] =;
MODULE_DEVICE_TABLE(pci, hinic_pci_table);

static struct pci_driver hinic_driver =;

static int __init hinic_module_init(void)
{}

static void __exit hinic_module_exit(void)
{}

module_init();
module_exit(hinic_module_exit);