// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2015 - 2022 Beijing WangXun Technology Co., Ltd. */ #include <linux/types.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/netdevice.h> #include <linux/string.h> #include <linux/etherdevice.h> #include <linux/phylink.h> #include <net/ip.h> #include <linux/if_vlan.h> #include "../libwx/wx_type.h" #include "../libwx/wx_lib.h" #include "../libwx/wx_hw.h" #include "txgbe_type.h" #include "txgbe_hw.h" #include "txgbe_phy.h" #include "txgbe_irq.h" #include "txgbe_fdir.h" #include "txgbe_ethtool.h" char txgbe_driver_name[] = …; /* txgbe_pci_tbl - PCI Device ID Table * * Wildcard entries (PCI_ANY_ID) should come last * Last entry must be all 0s * * { Vendor ID, Device ID, SubVendor ID, SubDevice ID, * Class, Class Mask, private data (not used) } */ static const struct pci_device_id txgbe_pci_tbl[] = …; #define DEFAULT_DEBUG_LEVEL_SHIFT … static void txgbe_check_minimum_link(struct wx *wx) { … } /** * txgbe_enumerate_functions - Get the number of ports this device has * @wx: wx structure * * This function enumerates the phsyical functions co-located on a single slot, * in order to determine how many ports a device has. This is most useful in * determining the required GT/s of PCIe bandwidth necessary for optimal * performance. **/ static int txgbe_enumerate_functions(struct wx *wx) { … } static void txgbe_up_complete(struct wx *wx) { … } static void txgbe_reset(struct wx *wx) { … } static void txgbe_disable_device(struct wx *wx) { … } void txgbe_down(struct wx *wx) { … } void txgbe_up(struct wx *wx) { … } /** * txgbe_init_type_code - Initialize the shared code * @wx: pointer to hardware structure **/ static void txgbe_init_type_code(struct wx *wx) { … } /** * txgbe_sw_init - Initialize general software structures (struct wx) * @wx: board private structure to initialize **/ static int txgbe_sw_init(struct wx *wx) { … } static void txgbe_init_fdir(struct txgbe *txgbe) { … } /** * txgbe_open - Called when a network interface is made active * @netdev: network interface device structure * * Returns 0 on success, negative value on failure * * The open entry point is called when a network interface is made * active by the system (IFF_UP). **/ static int txgbe_open(struct net_device *netdev) { … } /** * txgbe_close_suspend - actions necessary to both suspend and close flows * @wx: the private wx struct * * This function should contain the necessary work common to both suspending * and closing of the device. */ static void txgbe_close_suspend(struct wx *wx) { … } /** * txgbe_close - Disables a network interface * @netdev: network interface device structure * * Returns 0, this is not allowed to fail * * The close entry point is called when an interface is de-activated * by the OS. The hardware is still under the drivers control, but * needs to be disabled. A global MAC reset is issued to stop the * hardware, and all transmit and receive resources are freed. **/ static int txgbe_close(struct net_device *netdev) { … } static void txgbe_dev_shutdown(struct pci_dev *pdev) { … } static void txgbe_shutdown(struct pci_dev *pdev) { … } /** * txgbe_setup_tc - routine to configure net_device for multiple traffic * classes. * * @dev: net device to configure * @tc: number of traffic classes to enable */ int txgbe_setup_tc(struct net_device *dev, u8 tc) { … } static void txgbe_reinit_locked(struct wx *wx) { … } void txgbe_do_reset(struct net_device *netdev) { … } static const struct net_device_ops txgbe_netdev_ops = …; /** * txgbe_probe - Device Initialization Routine * @pdev: PCI device information struct * @ent: entry in txgbe_pci_tbl * * Returns 0 on success, negative on failure * * txgbe_probe initializes an adapter identified by a pci_dev structure. * The OS initialization, configuring of the wx private structure, * and a hardware reset occur. **/ static int txgbe_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) { … } /** * txgbe_remove - Device Removal Routine * @pdev: PCI device information struct * * txgbe_remove is called by the PCI subsystem to alert the driver * that it should release a PCI device. The could be caused by a * Hot-Plug event, or because the driver is going to be removed from * memory. **/ static void txgbe_remove(struct pci_dev *pdev) { … } static struct pci_driver txgbe_driver = …; module_pci_driver(…) …; MODULE_DEVICE_TABLE(pci, txgbe_pci_tbl); MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;