// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2018-2023, Intel Corporation. */ /* Intel(R) Ethernet Connection E800 Series Linux Driver */ #define pr_fmt(fmt) … #include <generated/utsrelease.h> #include <linux/crash_dump.h> #include "ice.h" #include "ice_base.h" #include "ice_lib.h" #include "ice_fltr.h" #include "ice_dcb_lib.h" #include "ice_dcb_nl.h" #include "devlink/devlink.h" #include "devlink/devlink_port.h" #include "ice_sf_eth.h" #include "ice_hwmon.h" /* Including ice_trace.h with CREATE_TRACE_POINTS defined will generate the * ice tracepoint functions. This must be done exactly once across the * ice driver. */ #define CREATE_TRACE_POINTS #include "ice_trace.h" #include "ice_eswitch.h" #include "ice_tc_lib.h" #include "ice_vsi_vlan_ops.h" #include <net/xdp_sock_drv.h> #define DRV_SUMMARY … static const char ice_driver_string[] = …; static const char ice_copyright[] = …; /* DDP Package file located in firmware search paths (e.g. /lib/firmware/) */ #define ICE_DDP_PKG_PATH … #define ICE_DDP_PKG_FILE … MODULE_DESCRIPTION(…); MODULE_IMPORT_NS(…); MODULE_LICENSE(…) …; MODULE_FIRMWARE(…); static int debug = …; module_param(debug, int, 0644); #ifndef CONFIG_DYNAMIC_DEBUG MODULE_PARM_DESC(debug, "netif level (0=none,...,16=all), hw debug_mask (0x8XXXXXXX)"); #else MODULE_PARM_DESC(…) …; #endif /* !CONFIG_DYNAMIC_DEBUG */ DEFINE_STATIC_KEY_FALSE(ice_xdp_locking_key); EXPORT_SYMBOL(…); /** * ice_hw_to_dev - Get device pointer from the hardware structure * @hw: pointer to the device HW structure * * Used to access the device pointer from compilation units which can't easily * include the definition of struct ice_pf without leading to circular header * dependencies. */ struct device *ice_hw_to_dev(struct ice_hw *hw) { … } static struct workqueue_struct *ice_wq; struct workqueue_struct *ice_lag_wq; static const struct net_device_ops ice_netdev_safe_mode_ops; static const struct net_device_ops ice_netdev_ops; static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type); static void ice_vsi_release_all(struct ice_pf *pf); static int ice_rebuild_channels(struct ice_pf *pf); static void ice_remove_q_channels(struct ice_vsi *vsi, bool rem_adv_fltr); static int ice_indr_setup_tc_cb(struct net_device *netdev, struct Qdisc *sch, void *cb_priv, enum tc_setup_type type, void *type_data, void *data, void (*cleanup)(struct flow_block_cb *block_cb)); bool netif_is_ice(const struct net_device *dev) { … } /** * ice_get_tx_pending - returns number of Tx descriptors not processed * @ring: the ring of descriptors */ static u16 ice_get_tx_pending(struct ice_tx_ring *ring) { … } /** * ice_check_for_hang_subtask - check for and recover hung queues * @pf: pointer to PF struct */ static void ice_check_for_hang_subtask(struct ice_pf *pf) { … } /** * ice_init_mac_fltr - Set initial MAC filters * @pf: board private structure * * Set initial set of MAC filters for PF VSI; configure filters for permanent * address and broadcast address. If an error is encountered, netdevice will be * unregistered. */ static int ice_init_mac_fltr(struct ice_pf *pf) { … } /** * ice_add_mac_to_sync_list - creates list of MAC addresses to be synced * @netdev: the net device on which the sync is happening * @addr: MAC address to sync * * This is a callback function which is called by the in kernel device sync * functions (like __dev_uc_sync, __dev_mc_sync, etc). This function only * populates the tmp_sync_list, which is later used by ice_add_mac to add the * MAC filters from the hardware. */ static int ice_add_mac_to_sync_list(struct net_device *netdev, const u8 *addr) { … } /** * ice_add_mac_to_unsync_list - creates list of MAC addresses to be unsynced * @netdev: the net device on which the unsync is happening * @addr: MAC address to unsync * * This is a callback function which is called by the in kernel device unsync * functions (like __dev_uc_unsync, __dev_mc_unsync, etc). This function only * populates the tmp_unsync_list, which is later used by ice_remove_mac to * delete the MAC filters from the hardware. */ static int ice_add_mac_to_unsync_list(struct net_device *netdev, const u8 *addr) { … } /** * ice_vsi_fltr_changed - check if filter state changed * @vsi: VSI to be checked * * returns true if filter state has changed, false otherwise. */ static bool ice_vsi_fltr_changed(struct ice_vsi *vsi) { … } /** * ice_set_promisc - Enable promiscuous mode for a given PF * @vsi: the VSI being configured * @promisc_m: mask of promiscuous config bits * */ static int ice_set_promisc(struct ice_vsi *vsi, u8 promisc_m) { … } /** * ice_clear_promisc - Disable promiscuous mode for a given PF * @vsi: the VSI being configured * @promisc_m: mask of promiscuous config bits * */ static int ice_clear_promisc(struct ice_vsi *vsi, u8 promisc_m) { … } /** * ice_vsi_sync_fltr - Update the VSI filter list to the HW * @vsi: ptr to the VSI * * Push any outstanding VSI filter changes through the AdminQ. */ static int ice_vsi_sync_fltr(struct ice_vsi *vsi) { … } /** * ice_sync_fltr_subtask - Sync the VSI filter list with HW * @pf: board private structure */ static void ice_sync_fltr_subtask(struct ice_pf *pf) { … } /** * ice_pf_dis_all_vsi - Pause all VSIs on a PF * @pf: the PF * @locked: is the rtnl_lock already held */ static void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked) { … } /** * ice_prepare_for_reset - prep for reset * @pf: board private structure * @reset_type: reset type requested * * Inform or close all dependent features in prep for reset. */ static void ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset_req reset_type) { … } /** * ice_do_reset - Initiate one of many types of resets * @pf: board private structure * @reset_type: reset type requested before this function was called. */ static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type) { … } /** * ice_reset_subtask - Set up for resetting the device and driver * @pf: board private structure */ static void ice_reset_subtask(struct ice_pf *pf) { … } /** * ice_print_topo_conflict - print topology conflict message * @vsi: the VSI whose topology status is being checked */ static void ice_print_topo_conflict(struct ice_vsi *vsi) { … } /** * ice_print_link_msg - print link up or down message * @vsi: the VSI whose link status is being queried * @isup: boolean for if the link is now up or down */ void ice_print_link_msg(struct ice_vsi *vsi, bool isup) { … } /** * ice_vsi_link_event - update the VSI's netdev * @vsi: the VSI on which the link event occurred * @link_up: whether or not the VSI needs to be set up or down */ static void ice_vsi_link_event(struct ice_vsi *vsi, bool link_up) { … } /** * ice_set_dflt_mib - send a default config MIB to the FW * @pf: private PF struct * * This function sends a default configuration MIB to the FW. * * If this function errors out at any point, the driver is still able to * function. The main impact is that LFC may not operate as expected. * Therefore an error state in this function should be treated with a DBG * message and continue on with driver rebuild/reenable. */ static void ice_set_dflt_mib(struct ice_pf *pf) { … } /** * ice_check_phy_fw_load - check if PHY FW load failed * @pf: pointer to PF struct * @link_cfg_err: bitmap from the link info structure * * check if external PHY FW load failed and print an error message if it did */ static void ice_check_phy_fw_load(struct ice_pf *pf, u8 link_cfg_err) { … } /** * ice_check_module_power * @pf: pointer to PF struct * @link_cfg_err: bitmap from the link info structure * * check module power level returned by a previous call to aq_get_link_info * and print error messages if module power level is not supported */ static void ice_check_module_power(struct ice_pf *pf, u8 link_cfg_err) { … } /** * ice_check_link_cfg_err - check if link configuration failed * @pf: pointer to the PF struct * @link_cfg_err: bitmap from the link info structure * * print if any link configuration failure happens due to the value in the * link_cfg_err parameter in the link info structure */ static void ice_check_link_cfg_err(struct ice_pf *pf, u8 link_cfg_err) { … } /** * ice_link_event - process the link event * @pf: PF that the link event is associated with * @pi: port_info for the port that the link event is associated with * @link_up: true if the physical link is up and false if it is down * @link_speed: current link speed received from the link event * * Returns 0 on success and negative on failure */ static int ice_link_event(struct ice_pf *pf, struct ice_port_info *pi, bool link_up, u16 link_speed) { … } /** * ice_watchdog_subtask - periodic tasks not using event driven scheduling * @pf: board private structure */ static void ice_watchdog_subtask(struct ice_pf *pf) { … } /** * ice_init_link_events - enable/initialize link events * @pi: pointer to the port_info instance * * Returns -EIO on failure, 0 on success */ static int ice_init_link_events(struct ice_port_info *pi) { … } /** * ice_handle_link_event - handle link event via ARQ * @pf: PF that the link event is associated with * @event: event structure containing link status info */ static int ice_handle_link_event(struct ice_pf *pf, struct ice_rq_event_info *event) { … } /** * ice_get_fwlog_data - copy the FW log data from ARQ event * @pf: PF that the FW log event is associated with * @event: event structure containing FW log data */ static void ice_get_fwlog_data(struct ice_pf *pf, struct ice_rq_event_info *event) { … } /** * ice_aq_prep_for_event - Prepare to wait for an AdminQ event from firmware * @pf: pointer to the PF private structure * @task: intermediate helper storage and identifier for waiting * @opcode: the opcode to wait for * * Prepares to wait for a specific AdminQ completion event on the ARQ for * a given PF. Actual wait would be done by a call to ice_aq_wait_for_event(). * * Calls are separated to allow caller registering for event before sending * the command, which mitigates a race between registering and FW responding. * * To obtain only the descriptor contents, pass an task->event with null * msg_buf. If the complete data buffer is desired, allocate the * task->event.msg_buf with enough space ahead of time. */ void ice_aq_prep_for_event(struct ice_pf *pf, struct ice_aq_task *task, u16 opcode) { … } /** * ice_aq_wait_for_event - Wait for an AdminQ event from firmware * @pf: pointer to the PF private structure * @task: ptr prepared by ice_aq_prep_for_event() * @timeout: how long to wait, in jiffies * * Waits for a specific AdminQ completion event on the ARQ for a given PF. The * current thread will be put to sleep until the specified event occurs or * until the given timeout is reached. * * Returns: zero on success, or a negative error code on failure. */ int ice_aq_wait_for_event(struct ice_pf *pf, struct ice_aq_task *task, unsigned long timeout) { … } /** * ice_aq_check_events - Check if any thread is waiting for an AdminQ event * @pf: pointer to the PF private structure * @opcode: the opcode of the event * @event: the event to check * * Loops over the current list of pending threads waiting for an AdminQ event. * For each matching task, copy the contents of the event into the task * structure and wake up the thread. * * If multiple threads wait for the same opcode, they will all be woken up. * * Note that event->msg_buf will only be duplicated if the event has a buffer * with enough space already allocated. Otherwise, only the descriptor and * message length will be copied. * * Returns: true if an event was found, false otherwise */ static void ice_aq_check_events(struct ice_pf *pf, u16 opcode, struct ice_rq_event_info *event) { … } /** * ice_aq_cancel_waiting_tasks - Immediately cancel all waiting tasks * @pf: the PF private structure * * Set all waiting tasks to ICE_AQ_TASK_CANCELED, and wake up their threads. * This will then cause ice_aq_wait_for_event to exit with -ECANCELED. */ static void ice_aq_cancel_waiting_tasks(struct ice_pf *pf) { … } #define ICE_MBX_OVERFLOW_WATERMARK … /** * __ice_clean_ctrlq - helper function to clean controlq rings * @pf: ptr to struct ice_pf * @q_type: specific Control queue type */ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type) { … } /** * ice_ctrlq_pending - check if there is a difference between ntc and ntu * @hw: pointer to hardware info * @cq: control queue information * * returns true if there are pending messages in a queue, false if there aren't */ static bool ice_ctrlq_pending(struct ice_hw *hw, struct ice_ctl_q_info *cq) { … } /** * ice_clean_adminq_subtask - clean the AdminQ rings * @pf: board private structure */ static void ice_clean_adminq_subtask(struct ice_pf *pf) { … } /** * ice_clean_mailboxq_subtask - clean the MailboxQ rings * @pf: board private structure */ static void ice_clean_mailboxq_subtask(struct ice_pf *pf) { … } /** * ice_clean_sbq_subtask - clean the Sideband Queue rings * @pf: board private structure */ static void ice_clean_sbq_subtask(struct ice_pf *pf) { … } /** * ice_service_task_schedule - schedule the service task to wake up * @pf: board private structure * * If not already scheduled, this puts the task into the work queue. */ void ice_service_task_schedule(struct ice_pf *pf) { … } /** * ice_service_task_complete - finish up the service task * @pf: board private structure */ static void ice_service_task_complete(struct ice_pf *pf) { … } /** * ice_service_task_stop - stop service task and cancel works * @pf: board private structure * * Return 0 if the ICE_SERVICE_DIS bit was not already set, * 1 otherwise. */ static int ice_service_task_stop(struct ice_pf *pf) { … } /** * ice_service_task_restart - restart service task and schedule works * @pf: board private structure * * This function is needed for suspend and resume works (e.g WoL scenario) */ static void ice_service_task_restart(struct ice_pf *pf) { … } /** * ice_service_timer - timer callback to schedule service task * @t: pointer to timer_list */ static void ice_service_timer(struct timer_list *t) { … } /** * ice_mdd_maybe_reset_vf - reset VF after MDD event * @pf: pointer to the PF structure * @vf: pointer to the VF structure * @reset_vf_tx: whether Tx MDD has occurred * @reset_vf_rx: whether Rx MDD has occurred * * Since the queue can get stuck on VF MDD events, the PF can be configured to * automatically reset the VF by enabling the private ethtool flag * mdd-auto-reset-vf. */ static void ice_mdd_maybe_reset_vf(struct ice_pf *pf, struct ice_vf *vf, bool reset_vf_tx, bool reset_vf_rx) { … } /** * ice_handle_mdd_event - handle malicious driver detect event * @pf: pointer to the PF structure * * Called from service task. OICR interrupt handler indicates MDD event. * VF MDD logging is guarded by net_ratelimit. Additional PF and VF log * messages are wrapped by netif_msg_[rx|tx]_err. Since VF Rx MDD events * disable the queue, the PF can be configured to reset the VF using ethtool * private flag mdd-auto-reset-vf. */ static void ice_handle_mdd_event(struct ice_pf *pf) { … } /** * ice_force_phys_link_state - Force the physical link state * @vsi: VSI to force the physical link state to up/down * @link_up: true/false indicates to set the physical link to up/down * * Force the physical link state by getting the current PHY capabilities from * hardware and setting the PHY config based on the determined capabilities. If * link changes a link event will be triggered because both the Enable Automatic * Link Update and LESM Enable bits are set when setting the PHY capabilities. * * Returns 0 on success, negative on failure */ static int ice_force_phys_link_state(struct ice_vsi *vsi, bool link_up) { … } /** * ice_init_nvm_phy_type - Initialize the NVM PHY type * @pi: port info structure * * Initialize nvm_phy_type_[low|high] for link lenient mode support */ static int ice_init_nvm_phy_type(struct ice_port_info *pi) { … } /** * ice_init_link_dflt_override - Initialize link default override * @pi: port info structure * * Initialize link default override and PHY total port shutdown during probe */ static void ice_init_link_dflt_override(struct ice_port_info *pi) { … } /** * ice_init_phy_cfg_dflt_override - Initialize PHY cfg default override settings * @pi: port info structure * * If default override is enabled, initialize the user PHY cfg speed and FEC * settings using the default override mask from the NVM. * * The PHY should only be configured with the default override settings the * first time media is available. The ICE_LINK_DEFAULT_OVERRIDE_PENDING state * is used to indicate that the user PHY cfg default override is initialized * and the PHY has not been configured with the default override settings. The * state is set here, and cleared in ice_configure_phy the first time the PHY is * configured. * * This function should be called only if the FW doesn't support default * configuration mode, as reported by ice_fw_supports_report_dflt_cfg. */ static void ice_init_phy_cfg_dflt_override(struct ice_port_info *pi) { … } /** * ice_init_phy_user_cfg - Initialize the PHY user configuration * @pi: port info structure * * Initialize the current user PHY configuration, speed, FEC, and FC requested * mode to default. The PHY defaults are from get PHY capabilities topology * with media so call when media is first available. An error is returned if * called when media is not available. The PHY initialization completed state is * set here. * * These configurations are used when setting PHY * configuration. The user PHY configuration is updated on set PHY * configuration. Returns 0 on success, negative on failure */ static int ice_init_phy_user_cfg(struct ice_port_info *pi) { … } /** * ice_configure_phy - configure PHY * @vsi: VSI of PHY * * Set the PHY configuration. If the current PHY configuration is the same as * the curr_user_phy_cfg, then do nothing to avoid link flap. Otherwise * configure the based get PHY capabilities for topology with media. */ static int ice_configure_phy(struct ice_vsi *vsi) { … } /** * ice_check_media_subtask - Check for media * @pf: pointer to PF struct * * If media is available, then initialize PHY user configuration if it is not * been, and configure the PHY if the interface is up. */ static void ice_check_media_subtask(struct ice_pf *pf) { … } /** * ice_service_task - manage and run subtasks * @work: pointer to work_struct contained by the PF struct */ static void ice_service_task(struct work_struct *work) { … } /** * ice_set_ctrlq_len - helper function to set controlq length * @hw: pointer to the HW instance */ static void ice_set_ctrlq_len(struct ice_hw *hw) { … } /** * ice_schedule_reset - schedule a reset * @pf: board private structure * @reset: reset being requested */ int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset) { … } /** * ice_irq_affinity_notify - Callback for affinity changes * @notify: context as to what irq was changed * @mask: the new affinity mask * * This is a callback function used by the irq_set_affinity_notifier function * so that we may register to receive changes to the irq affinity masks. */ static void ice_irq_affinity_notify(struct irq_affinity_notify *notify, const cpumask_t *mask) { … } /** * ice_irq_affinity_release - Callback for affinity notifier release * @ref: internal core kernel usage * * This is a callback function used by the irq_set_affinity_notifier function * to inform the current notification subscriber that they will no longer * receive notifications. */ static void ice_irq_affinity_release(struct kref __always_unused *ref) { … } /** * ice_vsi_ena_irq - Enable IRQ for the given VSI * @vsi: the VSI being configured */ static int ice_vsi_ena_irq(struct ice_vsi *vsi) { … } /** * ice_vsi_req_irq_msix - get MSI-X vectors from the OS for the VSI * @vsi: the VSI being configured * @basename: name for the vector */ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename) { … } /** * ice_xdp_alloc_setup_rings - Allocate and setup Tx rings for XDP * @vsi: VSI to setup Tx rings used by XDP * * Return 0 on success and negative value on error */ static int ice_xdp_alloc_setup_rings(struct ice_vsi *vsi) { … } /** * ice_vsi_assign_bpf_prog - set or clear bpf prog pointer on VSI * @vsi: VSI to set the bpf prog on * @prog: the bpf prog pointer */ static void ice_vsi_assign_bpf_prog(struct ice_vsi *vsi, struct bpf_prog *prog) { … } static struct ice_tx_ring *ice_xdp_ring_from_qid(struct ice_vsi *vsi, int qid) { … } /** * ice_map_xdp_rings - Map XDP rings to interrupt vectors * @vsi: the VSI with XDP rings being configured * * Map XDP rings to interrupt vectors and perform the configuration steps * dependent on the mapping. */ void ice_map_xdp_rings(struct ice_vsi *vsi) { … } /** * ice_prepare_xdp_rings - Allocate, configure and setup Tx rings for XDP * @vsi: VSI to bring up Tx rings used by XDP * @prog: bpf program that will be assigned to VSI * @cfg_type: create from scratch or restore the existing configuration * * Return 0 on success and negative value on error */ int ice_prepare_xdp_rings(struct ice_vsi *vsi, struct bpf_prog *prog, enum ice_xdp_cfg cfg_type) { … } /** * ice_destroy_xdp_rings - undo the configuration made by ice_prepare_xdp_rings * @vsi: VSI to remove XDP rings * @cfg_type: disable XDP permanently or allow it to be restored later * * Detach XDP rings from irq vectors, clean up the PF bitmap and free * resources */ int ice_destroy_xdp_rings(struct ice_vsi *vsi, enum ice_xdp_cfg cfg_type) { … } /** * ice_vsi_rx_napi_schedule - Schedule napi on RX queues from VSI * @vsi: VSI to schedule napi on */ static void ice_vsi_rx_napi_schedule(struct ice_vsi *vsi) { … } /** * ice_vsi_determine_xdp_res - figure out how many Tx qs can XDP have * @vsi: VSI to determine the count of XDP Tx qs * * returns 0 if Tx qs count is higher than at least half of CPU count, * -ENOMEM otherwise */ int ice_vsi_determine_xdp_res(struct ice_vsi *vsi) { … } /** * ice_max_xdp_frame_size - returns the maximum allowed frame size for XDP * @vsi: Pointer to VSI structure */ static int ice_max_xdp_frame_size(struct ice_vsi *vsi) { … } /** * ice_xdp_setup_prog - Add or remove XDP eBPF program * @vsi: VSI to setup XDP for * @prog: XDP program * @extack: netlink extended ack */ static int ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog, struct netlink_ext_ack *extack) { … } /** * ice_xdp_safe_mode - XDP handler for safe mode * @dev: netdevice * @xdp: XDP command */ static int ice_xdp_safe_mode(struct net_device __always_unused *dev, struct netdev_bpf *xdp) { … } /** * ice_xdp - implements XDP handler * @dev: netdevice * @xdp: XDP command */ int ice_xdp(struct net_device *dev, struct netdev_bpf *xdp) { … } /** * ice_ena_misc_vector - enable the non-queue interrupts * @pf: board private structure */ static void ice_ena_misc_vector(struct ice_pf *pf) { … } /** * ice_ll_ts_intr - ll_ts interrupt handler * @irq: interrupt number * @data: pointer to a q_vector */ static irqreturn_t ice_ll_ts_intr(int __always_unused irq, void *data) { … } /** * ice_misc_intr - misc interrupt handler * @irq: interrupt number * @data: pointer to a q_vector */ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data) { … } /** * ice_misc_intr_thread_fn - misc interrupt thread function * @irq: interrupt number * @data: pointer to a q_vector */ static irqreturn_t ice_misc_intr_thread_fn(int __always_unused irq, void *data) { … } /** * ice_dis_ctrlq_interrupts - disable control queue interrupts * @hw: pointer to HW structure */ static void ice_dis_ctrlq_interrupts(struct ice_hw *hw) { … } /** * ice_free_irq_msix_ll_ts- Unroll ll_ts vector setup * @pf: board private structure */ static void ice_free_irq_msix_ll_ts(struct ice_pf *pf) { … } /** * ice_free_irq_msix_misc - Unroll misc vector setup * @pf: board private structure */ static void ice_free_irq_msix_misc(struct ice_pf *pf) { … } /** * ice_ena_ctrlq_interrupts - enable control queue interrupts * @hw: pointer to HW structure * @reg_idx: HW vector index to associate the control queue interrupts with */ static void ice_ena_ctrlq_interrupts(struct ice_hw *hw, u16 reg_idx) { … } /** * ice_req_irq_msix_misc - Setup the misc vector to handle non queue events * @pf: board private structure * * This sets up the handler for MSIX 0, which is used to manage the * non-queue interrupts, e.g. AdminQ and errors. This is not used * when in MSI or Legacy interrupt mode. */ static int ice_req_irq_msix_misc(struct ice_pf *pf) { … } /** * ice_set_ops - set netdev and ethtools ops for the given netdev * @vsi: the VSI associated with the new netdev */ static void ice_set_ops(struct ice_vsi *vsi) { … } /** * ice_set_netdev_features - set features for the given netdev * @netdev: netdev instance */ void ice_set_netdev_features(struct net_device *netdev) { … } /** * ice_fill_rss_lut - Fill the RSS lookup table with default values * @lut: Lookup table * @rss_table_size: Lookup table size * @rss_size: Range of queue number for hashing */ void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size) { … } /** * ice_pf_vsi_setup - Set up a PF VSI * @pf: board private structure * @pi: pointer to the port_info instance * * Returns pointer to the successfully allocated VSI software struct * on success, otherwise returns NULL on failure. */ static struct ice_vsi * ice_pf_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) { … } static struct ice_vsi * ice_chnl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi, struct ice_channel *ch) { … } /** * ice_ctrl_vsi_setup - Set up a control VSI * @pf: board private structure * @pi: pointer to the port_info instance * * Returns pointer to the successfully allocated VSI software struct * on success, otherwise returns NULL on failure. */ static struct ice_vsi * ice_ctrl_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) { … } /** * ice_lb_vsi_setup - Set up a loopback VSI * @pf: board private structure * @pi: pointer to the port_info instance * * Returns pointer to the successfully allocated VSI software struct * on success, otherwise returns NULL on failure. */ struct ice_vsi * ice_lb_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) { … } /** * ice_vlan_rx_add_vid - Add a VLAN ID filter to HW offload * @netdev: network interface to be adjusted * @proto: VLAN TPID * @vid: VLAN ID to be added * * net_device_ops implementation for adding VLAN IDs */ int ice_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid) { … } /** * ice_vlan_rx_kill_vid - Remove a VLAN ID filter from HW offload * @netdev: network interface to be adjusted * @proto: VLAN TPID * @vid: VLAN ID to be removed * * net_device_ops implementation for removing VLAN IDs */ int ice_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid) { … } /** * ice_rep_indr_tc_block_unbind * @cb_priv: indirection block private data */ static void ice_rep_indr_tc_block_unbind(void *cb_priv) { … } /** * ice_tc_indir_block_unregister - Unregister TC indirect block notifications * @vsi: VSI struct which has the netdev */ static void ice_tc_indir_block_unregister(struct ice_vsi *vsi) { … } /** * ice_tc_indir_block_register - Register TC indirect block notifications * @vsi: VSI struct which has the netdev * * Returns 0 on success, negative value on failure */ static int ice_tc_indir_block_register(struct ice_vsi *vsi) { … } /** * ice_get_avail_q_count - Get count of queues in use * @pf_qmap: bitmap to get queue use count from * @lock: pointer to a mutex that protects access to pf_qmap * @size: size of the bitmap */ static u16 ice_get_avail_q_count(unsigned long *pf_qmap, struct mutex *lock, u16 size) { … } /** * ice_get_avail_txq_count - Get count of Tx queues in use * @pf: pointer to an ice_pf instance */ u16 ice_get_avail_txq_count(struct ice_pf *pf) { … } /** * ice_get_avail_rxq_count - Get count of Rx queues in use * @pf: pointer to an ice_pf instance */ u16 ice_get_avail_rxq_count(struct ice_pf *pf) { … } /** * ice_deinit_pf - Unrolls initialziations done by ice_init_pf * @pf: board private structure to initialize */ static void ice_deinit_pf(struct ice_pf *pf) { … } /** * ice_set_pf_caps - set PFs capability flags * @pf: pointer to the PF instance */ static void ice_set_pf_caps(struct ice_pf *pf) { … } /** * ice_init_pf - Initialize general software structures (struct ice_pf) * @pf: board private structure to initialize */ static int ice_init_pf(struct ice_pf *pf) { … } /** * ice_is_wol_supported - check if WoL is supported * @hw: pointer to hardware info * * Check if WoL is supported based on the HW configuration. * Returns true if NVM supports and enables WoL for this port, false otherwise */ bool ice_is_wol_supported(struct ice_hw *hw) { … } /** * ice_vsi_recfg_qs - Change the number of queues on a VSI * @vsi: VSI being changed * @new_rx: new number of Rx queues * @new_tx: new number of Tx queues * @locked: is adev device_lock held * * Only change the number of queues if new_tx, or new_rx is non-0. * * Returns 0 on success. */ int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked) { … } /** * ice_set_safe_mode_vlan_cfg - configure PF VSI to allow all VLANs in safe mode * @pf: PF to configure * * No VLAN offloads/filtering are advertised in safe mode so make sure the PF * VSI can still Tx/Rx VLAN tagged packets. */ static void ice_set_safe_mode_vlan_cfg(struct ice_pf *pf) { … } /** * ice_log_pkg_init - log result of DDP package load * @hw: pointer to hardware info * @state: state of package load */ static void ice_log_pkg_init(struct ice_hw *hw, enum ice_ddp_state state) { … } /** * ice_load_pkg - load/reload the DDP Package file * @firmware: firmware structure when firmware requested or NULL for reload * @pf: pointer to the PF instance * * Called on probe and post CORER/GLOBR rebuild to load DDP Package and * initialize HW tables. */ static void ice_load_pkg(const struct firmware *firmware, struct ice_pf *pf) { … } /** * ice_verify_cacheline_size - verify driver's assumption of 64 Byte cache lines * @pf: pointer to the PF structure * * There is no error returned here because the driver should be able to handle * 128 Byte cache lines, so we only print a warning in case issues are seen, * specifically with Tx. */ static void ice_verify_cacheline_size(struct ice_pf *pf) { … } /** * ice_send_version - update firmware with driver version * @pf: PF struct * * Returns 0 on success, else error code */ static int ice_send_version(struct ice_pf *pf) { … } /** * ice_init_fdir - Initialize flow director VSI and configuration * @pf: pointer to the PF instance * * returns 0 on success, negative on error */ static int ice_init_fdir(struct ice_pf *pf) { … } static void ice_deinit_fdir(struct ice_pf *pf) { … } /** * ice_get_opt_fw_name - return optional firmware file name or NULL * @pf: pointer to the PF instance */ static char *ice_get_opt_fw_name(struct ice_pf *pf) { … } /** * ice_request_fw - Device initialization routine * @pf: pointer to the PF instance * @firmware: double pointer to firmware struct * * Return: zero when successful, negative values otherwise. */ static int ice_request_fw(struct ice_pf *pf, const struct firmware **firmware) { … } /** * ice_init_tx_topology - performs Tx topology initialization * @hw: pointer to the hardware structure * @firmware: pointer to firmware structure * * Return: zero when init was successful, negative values otherwise. */ static int ice_init_tx_topology(struct ice_hw *hw, const struct firmware *firmware) { … } /** * ice_init_ddp_config - DDP related configuration * @hw: pointer to the hardware structure * @pf: pointer to pf structure * * This function loads DDP file from the disk, then initializes Tx * topology. At the end DDP package is loaded on the card. * * Return: zero when init was successful, negative values otherwise. */ static int ice_init_ddp_config(struct ice_hw *hw, struct ice_pf *pf) { … } /** * ice_print_wake_reason - show the wake up cause in the log * @pf: pointer to the PF struct */ static void ice_print_wake_reason(struct ice_pf *pf) { … } /** * ice_pf_fwlog_update_module - update 1 module * @pf: pointer to the PF struct * @log_level: log_level to use for the @module * @module: module to update */ void ice_pf_fwlog_update_module(struct ice_pf *pf, int log_level, int module) { … } /** * ice_register_netdev - register netdev * @vsi: pointer to the VSI struct */ static int ice_register_netdev(struct ice_vsi *vsi) { … } static void ice_unregister_netdev(struct ice_vsi *vsi) { … } /** * ice_cfg_netdev - Allocate, configure and register a netdev * @vsi: the VSI associated with the new netdev * * Returns 0 on success, negative value on failure */ static int ice_cfg_netdev(struct ice_vsi *vsi) { … } static void ice_decfg_netdev(struct ice_vsi *vsi) { … } /** * ice_wait_for_fw - wait for full FW readiness * @hw: pointer to the hardware structure * @timeout: milliseconds that can elapse before timing out */ static int ice_wait_for_fw(struct ice_hw *hw, u32 timeout) { … } int ice_init_dev(struct ice_pf *pf) { … } void ice_deinit_dev(struct ice_pf *pf) { … } static void ice_init_features(struct ice_pf *pf) { … } static void ice_deinit_features(struct ice_pf *pf) { … } static void ice_init_wakeup(struct ice_pf *pf) { … } static int ice_init_link(struct ice_pf *pf) { … } static int ice_init_pf_sw(struct ice_pf *pf) { … } static void ice_deinit_pf_sw(struct ice_pf *pf) { … } static int ice_alloc_vsis(struct ice_pf *pf) { … } static void ice_dealloc_vsis(struct ice_pf *pf) { … } static int ice_init_devlink(struct ice_pf *pf) { … } static void ice_deinit_devlink(struct ice_pf *pf) { … } static int ice_init(struct ice_pf *pf) { … } static void ice_deinit(struct ice_pf *pf) { … } /** * ice_load - load pf by init hw and starting VSI * @pf: pointer to the pf instance * * This function has to be called under devl_lock. */ int ice_load(struct ice_pf *pf) { … } /** * ice_unload - unload pf by stopping VSI and deinit hw * @pf: pointer to the pf instance * * This function has to be called under devl_lock. */ void ice_unload(struct ice_pf *pf) { … } /** * ice_probe - Device initialization routine * @pdev: PCI device information struct * @ent: entry in ice_pci_tbl * * Returns 0 on success, negative on failure */ static int ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) { … } /** * ice_set_wake - enable or disable Wake on LAN * @pf: pointer to the PF struct * * Simple helper for WoL control */ static void ice_set_wake(struct ice_pf *pf) { … } /** * ice_setup_mc_magic_wake - setup device to wake on multicast magic packet * @pf: pointer to the PF struct * * Issue firmware command to enable multicast magic wake, making * sure that any locally administered address (LAA) is used for * wake, and that PF reset doesn't undo the LAA. */ static void ice_setup_mc_magic_wake(struct ice_pf *pf) { … } /** * ice_remove - Device removal routine * @pdev: PCI device information struct */ static void ice_remove(struct pci_dev *pdev) { … } /** * ice_shutdown - PCI callback for shutting down device * @pdev: PCI device information struct */ static void ice_shutdown(struct pci_dev *pdev) { … } /** * ice_prepare_for_shutdown - prep for PCI shutdown * @pf: board private structure * * Inform or close all dependent features in prep for PCI device shutdown */ static void ice_prepare_for_shutdown(struct ice_pf *pf) { … } /** * ice_reinit_interrupt_scheme - Reinitialize interrupt scheme * @pf: board private structure to reinitialize * * This routine reinitialize interrupt scheme that was cleared during * power management suspend callback. * * This should be called during resume routine to re-allocate the q_vectors * and reacquire interrupts. */ static int ice_reinit_interrupt_scheme(struct ice_pf *pf) { … } /** * ice_suspend * @dev: generic device information structure * * Power Management callback to quiesce the device and prepare * for D3 transition. */ static int ice_suspend(struct device *dev) { … } /** * ice_resume - PM callback for waking up from D3 * @dev: generic device information structure */ static int ice_resume(struct device *dev) { … } /** * ice_pci_err_detected - warning that PCI error has been detected * @pdev: PCI device information struct * @err: the type of PCI error * * Called to warn that something happened on the PCI bus and the error handling * is in progress. Allows the driver to gracefully prepare/handle PCI errors. */ static pci_ers_result_t ice_pci_err_detected(struct pci_dev *pdev, pci_channel_state_t err) { … } /** * ice_pci_err_slot_reset - a PCI slot reset has just happened * @pdev: PCI device information struct * * Called to determine if the driver can recover from the PCI slot reset by * using a register read to determine if the device is recoverable. */ static pci_ers_result_t ice_pci_err_slot_reset(struct pci_dev *pdev) { … } /** * ice_pci_err_resume - restart operations after PCI error recovery * @pdev: PCI device information struct * * Called to allow the driver to bring things back up after PCI error and/or * reset recovery have finished */ static void ice_pci_err_resume(struct pci_dev *pdev) { … } /** * ice_pci_err_reset_prepare - prepare device driver for PCI reset * @pdev: PCI device information struct */ static void ice_pci_err_reset_prepare(struct pci_dev *pdev) { … } /** * ice_pci_err_reset_done - PCI reset done, device driver reset can begin * @pdev: PCI device information struct */ static void ice_pci_err_reset_done(struct pci_dev *pdev) { … } /* ice_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 ice_pci_tbl[] = …; MODULE_DEVICE_TABLE(pci, ice_pci_tbl); static DEFINE_SIMPLE_DEV_PM_OPS(ice_pm_ops, ice_suspend, ice_resume); static const struct pci_error_handlers ice_pci_err_handler = …; static struct pci_driver ice_driver = …; /** * ice_module_init - Driver registration routine * * ice_module_init is the first routine called when the driver is * loaded. All it does is register with the PCI subsystem. */ static int __init ice_module_init(void) { … } module_init(…) …; /** * ice_module_exit - Driver exit cleanup routine * * ice_module_exit is called just before the driver is removed * from memory. */ static void __exit ice_module_exit(void) { … } module_exit(ice_module_exit); /** * ice_set_mac_address - NDO callback to set MAC address * @netdev: network interface device structure * @pi: pointer to an address structure * * Returns 0 on success, negative on failure */ static int ice_set_mac_address(struct net_device *netdev, void *pi) { … } /** * ice_set_rx_mode - NDO callback to set the netdev filters * @netdev: network interface device structure */ static void ice_set_rx_mode(struct net_device *netdev) { … } /** * ice_set_tx_maxrate - NDO callback to set the maximum per-queue bitrate * @netdev: network interface device structure * @queue_index: Queue ID * @maxrate: maximum bandwidth in Mbps */ static int ice_set_tx_maxrate(struct net_device *netdev, int queue_index, u32 maxrate) { … } /** * ice_fdb_add - add an entry to the hardware database * @ndm: the input from the stack * @tb: pointer to array of nladdr (unused) * @dev: the net device pointer * @addr: the MAC address entry being added * @vid: VLAN ID * @flags: instructions from stack about fdb operation * @extack: netlink extended ack */ static int ice_fdb_add(struct ndmsg *ndm, struct nlattr __always_unused *tb[], struct net_device *dev, const unsigned char *addr, u16 vid, u16 flags, struct netlink_ext_ack __always_unused *extack) { … } /** * ice_fdb_del - delete an entry from the hardware database * @ndm: the input from the stack * @tb: pointer to array of nladdr (unused) * @dev: the net device pointer * @addr: the MAC address entry being added * @vid: VLAN ID * @extack: netlink extended ack */ static int ice_fdb_del(struct ndmsg *ndm, __always_unused struct nlattr *tb[], struct net_device *dev, const unsigned char *addr, __always_unused u16 vid, struct netlink_ext_ack *extack) { … } #define NETIF_VLAN_OFFLOAD_FEATURES … #define NETIF_VLAN_STRIPPING_FEATURES … #define NETIF_VLAN_FILTERING_FEATURES … /** * ice_fix_features - fix the netdev features flags based on device limitations * @netdev: ptr to the netdev that flags are being fixed on * @features: features that need to be checked and possibly fixed * * Make sure any fixups are made to features in this callback. This enables the * driver to not have to check unsupported configurations throughout the driver * because that's the responsiblity of this callback. * * Single VLAN Mode (SVM) Supported Features: * NETIF_F_HW_VLAN_CTAG_FILTER * NETIF_F_HW_VLAN_CTAG_RX * NETIF_F_HW_VLAN_CTAG_TX * * Double VLAN Mode (DVM) Supported Features: * NETIF_F_HW_VLAN_CTAG_FILTER * NETIF_F_HW_VLAN_CTAG_RX * NETIF_F_HW_VLAN_CTAG_TX * * NETIF_F_HW_VLAN_STAG_FILTER * NETIF_HW_VLAN_STAG_RX * NETIF_HW_VLAN_STAG_TX * * Features that need fixing: * Cannot simultaneously enable CTAG and STAG stripping and/or insertion. * These are mutually exlusive as the VSI context cannot support multiple * VLAN ethertypes simultaneously for stripping and/or insertion. If this * is not done, then default to clearing the requested STAG offload * settings. * * All supported filtering has to be enabled or disabled together. For * example, in DVM, CTAG and STAG filtering have to be enabled and disabled * together. If this is not done, then default to VLAN filtering disabled. * These are mutually exclusive as there is currently no way to * enable/disable VLAN filtering based on VLAN ethertype when using VLAN * prune rules. */ static netdev_features_t ice_fix_features(struct net_device *netdev, netdev_features_t features) { … } /** * ice_set_rx_rings_vlan_proto - update rings with new stripped VLAN proto * @vsi: PF's VSI * @vlan_ethertype: VLAN ethertype (802.1Q or 802.1ad) in network byte order * * Store current stripped VLAN proto in ring packet context, * so it can be accessed more efficiently by packet processing code. */ static void ice_set_rx_rings_vlan_proto(struct ice_vsi *vsi, __be16 vlan_ethertype) { … } /** * ice_set_vlan_offload_features - set VLAN offload features for the PF VSI * @vsi: PF's VSI * @features: features used to determine VLAN offload settings * * First, determine the vlan_ethertype based on the VLAN offload bits in * features. Then determine if stripping and insertion should be enabled or * disabled. Finally enable or disable VLAN stripping and insertion. */ static int ice_set_vlan_offload_features(struct ice_vsi *vsi, netdev_features_t features) { … } /** * ice_set_vlan_filtering_features - set VLAN filtering features for the PF VSI * @vsi: PF's VSI * @features: features used to determine VLAN filtering settings * * Enable or disable Rx VLAN filtering based on the VLAN filtering bits in the * features. */ static int ice_set_vlan_filtering_features(struct ice_vsi *vsi, netdev_features_t features) { … } /** * ice_set_vlan_features - set VLAN settings based on suggested feature set * @netdev: ptr to the netdev being adjusted * @features: the feature set that the stack is suggesting * * Only update VLAN settings if the requested_vlan_features are different than * the current_vlan_features. */ static int ice_set_vlan_features(struct net_device *netdev, netdev_features_t features) { … } /** * ice_set_loopback - turn on/off loopback mode on underlying PF * @vsi: ptr to VSI * @ena: flag to indicate the on/off setting */ static int ice_set_loopback(struct ice_vsi *vsi, bool ena) { … } /** * ice_set_features - set the netdev feature flags * @netdev: ptr to the netdev being adjusted * @features: the feature set that the stack is suggesting */ static int ice_set_features(struct net_device *netdev, netdev_features_t features) { … } /** * ice_vsi_vlan_setup - Setup VLAN offload properties on a PF VSI * @vsi: VSI to setup VLAN properties for */ static int ice_vsi_vlan_setup(struct ice_vsi *vsi) { … } /** * ice_vsi_cfg_lan - Setup the VSI lan related config * @vsi: the VSI being configured * * Return 0 on success and negative value on error */ int ice_vsi_cfg_lan(struct ice_vsi *vsi) { … } /* THEORY OF MODERATION: * The ice driver hardware works differently than the hardware that DIMLIB was * originally made for. ice hardware doesn't have packet count limits that * can trigger an interrupt, but it *does* have interrupt rate limit support, * which is hard-coded to a limit of 250,000 ints/second. * If not using dynamic moderation, the INTRL value can be modified * by ethtool rx-usecs-high. */ struct ice_dim { … }; /* Make a different profile for Rx that doesn't allow quite so aggressive * moderation at the high end (it maxes out at 126us or about 8k interrupts a * second. */ static const struct ice_dim rx_profile[] = …; /* The transmit profile, which has the same sorts of values * as the previous struct */ static const struct ice_dim tx_profile[] = …; static void ice_tx_dim_work(struct work_struct *work) { … } static void ice_rx_dim_work(struct work_struct *work) { … } #define ICE_DIM_DEFAULT_PROFILE_IX … /** * ice_init_moderation - set up interrupt moderation * @q_vector: the vector containing rings to be configured * * Set up interrupt moderation registers, with the intent to do the right thing * when called from reset or from probe, and whether or not dynamic moderation * is enabled or not. Take special care to write all the registers in both * dynamic moderation mode or not in order to make sure hardware is in a known * state. */ static void ice_init_moderation(struct ice_q_vector *q_vector) { … } /** * ice_napi_enable_all - Enable NAPI for all q_vectors in the VSI * @vsi: the VSI being configured */ static void ice_napi_enable_all(struct ice_vsi *vsi) { … } /** * ice_up_complete - Finish the last steps of bringing up a connection * @vsi: The VSI being configured * * Return 0 on success and negative value on error */ static int ice_up_complete(struct ice_vsi *vsi) { … } /** * ice_up - Bring the connection back up after being down * @vsi: VSI being configured */ int ice_up(struct ice_vsi *vsi) { … } /** * ice_fetch_u64_stats_per_ring - get packets and bytes stats per ring * @syncp: pointer to u64_stats_sync * @stats: stats that pkts and bytes count will be taken from * @pkts: packets stats counter * @bytes: bytes stats counter * * This function fetches stats from the ring considering the atomic operations * that needs to be performed to read u64 values in 32 bit machine. */ void ice_fetch_u64_stats_per_ring(struct u64_stats_sync *syncp, struct ice_q_stats stats, u64 *pkts, u64 *bytes) { … } /** * ice_update_vsi_tx_ring_stats - Update VSI Tx ring stats counters * @vsi: the VSI to be updated * @vsi_stats: the stats struct to be updated * @rings: rings to work on * @count: number of rings */ static void ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi, struct rtnl_link_stats64 *vsi_stats, struct ice_tx_ring **rings, u16 count) { … } /** * ice_update_vsi_ring_stats - Update VSI stats counters * @vsi: the VSI to be updated */ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi) { … } /** * ice_update_vsi_stats - Update VSI stats counters * @vsi: the VSI to be updated */ void ice_update_vsi_stats(struct ice_vsi *vsi) { … } /** * ice_update_pf_stats - Update PF port stats counters * @pf: PF whose stats needs to be updated */ void ice_update_pf_stats(struct ice_pf *pf) { … } /** * ice_get_stats64 - get statistics for network device structure * @netdev: network interface device structure * @stats: main device statistics structure */ void ice_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) { … } /** * ice_napi_disable_all - Disable NAPI for all q_vectors in the VSI * @vsi: VSI having NAPI disabled */ static void ice_napi_disable_all(struct ice_vsi *vsi) { … } /** * ice_vsi_dis_irq - Mask off queue interrupt generation on the VSI * @vsi: the VSI being un-configured */ static void ice_vsi_dis_irq(struct ice_vsi *vsi) { … } /** * ice_down - Shutdown the connection * @vsi: The VSI being stopped * * Caller of this function is expected to set the vsi->state ICE_DOWN bit */ int ice_down(struct ice_vsi *vsi) { … } /** * ice_down_up - shutdown the VSI connection and bring it up * @vsi: the VSI to be reconnected */ int ice_down_up(struct ice_vsi *vsi) { … } /** * ice_vsi_setup_tx_rings - Allocate VSI Tx queue resources * @vsi: VSI having resources allocated * * Return 0 on success, negative on failure */ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi) { … } /** * ice_vsi_setup_rx_rings - Allocate VSI Rx queue resources * @vsi: VSI having resources allocated * * Return 0 on success, negative on failure */ int ice_vsi_setup_rx_rings(struct ice_vsi *vsi) { … } /** * ice_vsi_open_ctrl - open control VSI for use * @vsi: the VSI to open * * Initialization of the Control VSI * * Returns 0 on success, negative value on error */ int ice_vsi_open_ctrl(struct ice_vsi *vsi) { … } /** * ice_vsi_open - Called when a network interface is made active * @vsi: the VSI to open * * Initialization of the VSI * * Returns 0 on success, negative value on error */ int ice_vsi_open(struct ice_vsi *vsi) { … } /** * ice_vsi_release_all - Delete all VSIs * @pf: PF from which all VSIs are being removed */ static void ice_vsi_release_all(struct ice_pf *pf) { … } /** * ice_vsi_rebuild_by_type - Rebuild VSI of a given type * @pf: pointer to the PF instance * @type: VSI type to rebuild * * Iterates through the pf->vsi array and rebuilds VSIs of the requested type */ static int ice_vsi_rebuild_by_type(struct ice_pf *pf, enum ice_vsi_type type) { … } /** * ice_update_pf_netdev_link - Update PF netdev link status * @pf: pointer to the PF instance */ static void ice_update_pf_netdev_link(struct ice_pf *pf) { … } /** * ice_rebuild - rebuild after reset * @pf: PF to rebuild * @reset_type: type of reset * * Do not rebuild VF VSI in this flow because that is already handled via * ice_reset_all_vfs(). This is because requirements for resetting a VF after a * PFR/CORER/GLOBER/etc. are different than the normal flow. Also, we don't want * to reset/rebuild all the VF VSI twice. */ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type) { … } /** * ice_change_mtu - NDO callback to change the MTU * @netdev: network interface device structure * @new_mtu: new value for maximum frame size * * Returns 0 on success, negative on failure */ int ice_change_mtu(struct net_device *netdev, int new_mtu) { … } /** * ice_eth_ioctl - Access the hwtstamp interface * @netdev: network interface device structure * @ifr: interface request data * @cmd: ioctl command */ static int ice_eth_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) { … } /** * ice_aq_str - convert AQ err code to a string * @aq_err: the AQ error code to convert */ const char *ice_aq_str(enum ice_aq_err aq_err) { … } /** * ice_set_rss_lut - Set RSS LUT * @vsi: Pointer to VSI structure * @lut: Lookup table * @lut_size: Lookup table size * * Returns 0 on success, negative on failure */ int ice_set_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size) { … } /** * ice_set_rss_key - Set RSS key * @vsi: Pointer to the VSI structure * @seed: RSS hash seed * * Returns 0 on success, negative on failure */ int ice_set_rss_key(struct ice_vsi *vsi, u8 *seed) { … } /** * ice_get_rss_lut - Get RSS LUT * @vsi: Pointer to VSI structure * @lut: Buffer to store the lookup table entries * @lut_size: Size of buffer to store the lookup table entries * * Returns 0 on success, negative on failure */ int ice_get_rss_lut(struct ice_vsi *vsi, u8 *lut, u16 lut_size) { … } /** * ice_get_rss_key - Get RSS key * @vsi: Pointer to VSI structure * @seed: Buffer to store the key in * * Returns 0 on success, negative on failure */ int ice_get_rss_key(struct ice_vsi *vsi, u8 *seed) { … } /** * ice_set_rss_hfunc - Set RSS HASH function * @vsi: Pointer to VSI structure * @hfunc: hash function (ICE_AQ_VSI_Q_OPT_RSS_*) * * Returns 0 on success, negative on failure */ int ice_set_rss_hfunc(struct ice_vsi *vsi, u8 hfunc) { … } /** * ice_bridge_getlink - Get the hardware bridge mode * @skb: skb buff * @pid: process ID * @seq: RTNL message seq * @dev: the netdev being configured * @filter_mask: filter mask passed in * @nlflags: netlink flags passed in * * Return the bridge mode (VEB/VEPA) */ static int ice_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, struct net_device *dev, u32 filter_mask, int nlflags) { … } /** * ice_vsi_update_bridge_mode - Update VSI for switching bridge mode (VEB/VEPA) * @vsi: Pointer to VSI structure * @bmode: Hardware bridge mode (VEB/VEPA) * * Returns 0 on success, negative on failure */ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode) { … } /** * ice_bridge_setlink - Set the hardware bridge mode * @dev: the netdev being configured * @nlh: RTNL message * @flags: bridge setlink flags * @extack: netlink extended ack * * Sets the bridge mode (VEB/VEPA) of the switch to which the netdev (VSI) is * hooked up to. Iterates through the PF VSI list and sets the loopback mode (if * not already set for all VSIs connected to this switch. And also update the * unicast switch filter rules for the corresponding switch of the netdev. */ static int ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 __always_unused flags, struct netlink_ext_ack __always_unused *extack) { … } /** * ice_tx_timeout - Respond to a Tx Hang * @netdev: network interface device structure * @txqueue: Tx queue */ void ice_tx_timeout(struct net_device *netdev, unsigned int txqueue) { … } /** * ice_setup_tc_cls_flower - flower classifier offloads * @np: net device to configure * @filter_dev: device on which filter is added * @cls_flower: offload data */ static int ice_setup_tc_cls_flower(struct ice_netdev_priv *np, struct net_device *filter_dev, struct flow_cls_offload *cls_flower) { … } /** * ice_setup_tc_block_cb - callback handler registered for TC block * @type: TC SETUP type * @type_data: TC flower offload data that contains user input * @cb_priv: netdev private data */ static int ice_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv) { … } /** * ice_validate_mqprio_qopt - Validate TCF input parameters * @vsi: Pointer to VSI * @mqprio_qopt: input parameters for mqprio queue configuration * * This function validates MQPRIO params, such as qcount (power of 2 wherever * needed), and make sure user doesn't specify qcount and BW rate limit * for TCs, which are more than "num_tc" */ static int ice_validate_mqprio_qopt(struct ice_vsi *vsi, struct tc_mqprio_qopt_offload *mqprio_qopt) { … } /** * ice_add_vsi_to_fdir - add a VSI to the flow director group for PF * @pf: ptr to PF device * @vsi: ptr to VSI */ static int ice_add_vsi_to_fdir(struct ice_pf *pf, struct ice_vsi *vsi) { … } /** * ice_add_channel - add a channel by adding VSI * @pf: ptr to PF device * @sw_id: underlying HW switching element ID * @ch: ptr to channel structure * * Add a channel (VSI) using add_vsi and queue_map */ static int ice_add_channel(struct ice_pf *pf, u16 sw_id, struct ice_channel *ch) { … } /** * ice_chnl_cfg_res * @vsi: the VSI being setup * @ch: ptr to channel structure * * Configure channel specific resources such as rings, vector. */ static void ice_chnl_cfg_res(struct ice_vsi *vsi, struct ice_channel *ch) { … } /** * ice_cfg_chnl_all_res - configure channel resources * @vsi: pte to main_vsi * @ch: ptr to channel structure * * This function configures channel specific resources such as flow-director * counter index, and other resources such as queues, vectors, ITR settings */ static void ice_cfg_chnl_all_res(struct ice_vsi *vsi, struct ice_channel *ch) { … } /** * ice_setup_hw_channel - setup new channel * @pf: ptr to PF device * @vsi: the VSI being setup * @ch: ptr to channel structure * @sw_id: underlying HW switching element ID * @type: type of channel to be created (VMDq2/VF) * * Setup new channel (VSI) based on specified type (VMDq2/VF) * and configures Tx rings accordingly */ static int ice_setup_hw_channel(struct ice_pf *pf, struct ice_vsi *vsi, struct ice_channel *ch, u16 sw_id, u8 type) { … } /** * ice_setup_channel - setup new channel using uplink element * @pf: ptr to PF device * @vsi: the VSI being setup * @ch: ptr to channel structure * * Setup new channel (VSI) based on specified type (VMDq2/VF) * and uplink switching element */ static bool ice_setup_channel(struct ice_pf *pf, struct ice_vsi *vsi, struct ice_channel *ch) { … } /** * ice_set_bw_limit - setup BW limit for Tx traffic based on max_tx_rate * @vsi: VSI to be configured * @max_tx_rate: max Tx rate in Kbps to be configured as maximum BW limit * @min_tx_rate: min Tx rate in Kbps to be configured as minimum BW limit */ static int ice_set_bw_limit(struct ice_vsi *vsi, u64 max_tx_rate, u64 min_tx_rate) { … } /** * ice_create_q_channel - function to create channel * @vsi: VSI to be configured * @ch: ptr to channel (it contains channel specific params) * * This function creates channel (VSI) using num_queues specified by user, * reconfigs RSS if needed. */ static int ice_create_q_channel(struct ice_vsi *vsi, struct ice_channel *ch) { … } /** * ice_rem_all_chnl_fltrs - removes all channel filters * @pf: ptr to PF, TC-flower based filter are tracked at PF level * * Remove all advanced switch filters only if they are channel specific * tc-flower based filter */ static void ice_rem_all_chnl_fltrs(struct ice_pf *pf) { … } /** * ice_remove_q_channels - Remove queue channels for the TCs * @vsi: VSI to be configured * @rem_fltr: delete advanced switch filter or not * * Remove queue channels for the TCs */ static void ice_remove_q_channels(struct ice_vsi *vsi, bool rem_fltr) { … } /** * ice_rebuild_channels - rebuild channel * @pf: ptr to PF * * Recreate channel VSIs and replay filters */ static int ice_rebuild_channels(struct ice_pf *pf) { … } /** * ice_create_q_channels - Add queue channel for the given TCs * @vsi: VSI to be configured * * Configures queue channel mapping to the given TCs */ static int ice_create_q_channels(struct ice_vsi *vsi) { … } /** * ice_setup_tc_mqprio_qdisc - configure multiple traffic classes * @netdev: net device to configure * @type_data: TC offload data */ static int ice_setup_tc_mqprio_qdisc(struct net_device *netdev, void *type_data) { … } static LIST_HEAD(ice_block_cb_list); static int ice_setup_tc(struct net_device *netdev, enum tc_setup_type type, void *type_data) { … } static struct ice_indr_block_priv * ice_indr_block_priv_lookup(struct ice_netdev_priv *np, struct net_device *netdev) { … } static int ice_indr_setup_block_cb(enum tc_setup_type type, void *type_data, void *indr_priv) { … } static int ice_indr_setup_tc_block(struct net_device *netdev, struct Qdisc *sch, struct ice_netdev_priv *np, struct flow_block_offload *f, void *data, void (*cleanup)(struct flow_block_cb *block_cb)) { … } static int ice_indr_setup_tc_cb(struct net_device *netdev, struct Qdisc *sch, void *cb_priv, enum tc_setup_type type, void *type_data, void *data, void (*cleanup)(struct flow_block_cb *block_cb)) { … } /** * ice_open - Called when a network interface becomes active * @netdev: network interface device structure * * The open entry point is called when a network interface is made * active by the system (IFF_UP). At this point all resources needed * for transmit and receive operations are allocated, the interrupt * handler is registered with the OS, the netdev watchdog is enabled, * and the stack is notified that the interface is ready. * * Returns 0 on success, negative value on failure */ int ice_open(struct net_device *netdev) { … } /** * ice_open_internal - Called when a network interface becomes active * @netdev: network interface device structure * * Internal ice_open implementation. Should not be used directly except for ice_open and reset * handling routine * * Returns 0 on success, negative value on failure */ int ice_open_internal(struct net_device *netdev) { … } /** * ice_stop - Disables a network interface * @netdev: network interface device structure * * The stop entry point is called when an interface is de-activated by the OS, * and the netdevice enters the DOWN state. The hardware is still under the * driver's control, but the netdev interface is disabled. * * Returns success only - not allowed to fail */ int ice_stop(struct net_device *netdev) { … } /** * ice_features_check - Validate encapsulated packet conforms to limits * @skb: skb buffer * @netdev: This port's netdev * @features: Offload features that the stack believes apply */ static netdev_features_t ice_features_check(struct sk_buff *skb, struct net_device __always_unused *netdev, netdev_features_t features) { … } static const struct net_device_ops ice_netdev_safe_mode_ops = …; static const struct net_device_ops ice_netdev_ops = …;