// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2018, Intel Corporation. */ #include "ice.h" #include "ice_base.h" #include "ice_flow.h" #include "ice_lib.h" #include "ice_fltr.h" #include "ice_dcb_lib.h" #include "ice_type.h" #include "ice_vsi_vlan_ops.h" /** * ice_vsi_type_str - maps VSI type enum to string equivalents * @vsi_type: VSI type enum */ const char *ice_vsi_type_str(enum ice_vsi_type vsi_type) { … } /** * ice_vsi_ctrl_all_rx_rings - Start or stop a VSI's Rx rings * @vsi: the VSI being configured * @ena: start or stop the Rx rings * * First enable/disable all of the Rx rings, flush any remaining writes, and * then verify that they have all been enabled/disabled successfully. This will * let all of the register writes complete when enabling/disabling the Rx rings * before waiting for the change in hardware to complete. */ static int ice_vsi_ctrl_all_rx_rings(struct ice_vsi *vsi, bool ena) { … } /** * ice_vsi_alloc_arrays - Allocate queue and vector pointer arrays for the VSI * @vsi: VSI pointer * * On error: returns error code (negative) * On success: returns 0 */ static int ice_vsi_alloc_arrays(struct ice_vsi *vsi) { … } /** * ice_vsi_set_num_desc - Set number of descriptors for queues on this VSI * @vsi: the VSI being configured */ static void ice_vsi_set_num_desc(struct ice_vsi *vsi) { … } /** * ice_vsi_set_num_qs - Set number of queues, descriptors and vectors for a VSI * @vsi: the VSI being configured * * Return 0 on success and a negative value on error */ static void ice_vsi_set_num_qs(struct ice_vsi *vsi) { … } /** * ice_get_free_slot - get the next non-NULL location index in array * @array: array to search * @size: size of the array * @curr: last known occupied index to be used as a search hint * * void * is being used to keep the functionality generic. This lets us use this * function on any array of pointers. */ static int ice_get_free_slot(void *array, int size, int curr) { … } /** * ice_vsi_delete_from_hw - delete a VSI from the switch * @vsi: pointer to VSI being removed */ static void ice_vsi_delete_from_hw(struct ice_vsi *vsi) { … } /** * ice_vsi_free_arrays - De-allocate queue and vector pointer arrays for the VSI * @vsi: pointer to VSI being cleared */ static void ice_vsi_free_arrays(struct ice_vsi *vsi) { … } /** * ice_vsi_free_stats - Free the ring statistics structures * @vsi: VSI pointer */ static void ice_vsi_free_stats(struct ice_vsi *vsi) { … } /** * ice_vsi_alloc_ring_stats - Allocates Tx and Rx ring stats for the VSI * @vsi: VSI which is having stats allocated */ static int ice_vsi_alloc_ring_stats(struct ice_vsi *vsi) { … } /** * ice_vsi_free - clean up and deallocate the provided VSI * @vsi: pointer to VSI being cleared * * This deallocates the VSI's queue resources, removes it from the PF's * VSI array if necessary, and deallocates the VSI */ void ice_vsi_free(struct ice_vsi *vsi) { … } void ice_vsi_delete(struct ice_vsi *vsi) { … } /** * ice_msix_clean_ctrl_vsi - MSIX mode interrupt handler for ctrl VSI * @irq: interrupt number * @data: pointer to a q_vector */ static irqreturn_t ice_msix_clean_ctrl_vsi(int __always_unused irq, void *data) { … } /** * ice_msix_clean_rings - MSIX mode Interrupt Handler * @irq: interrupt number * @data: pointer to a q_vector */ static irqreturn_t ice_msix_clean_rings(int __always_unused irq, void *data) { … } /** * ice_vsi_alloc_stat_arrays - Allocate statistics arrays * @vsi: VSI pointer */ static int ice_vsi_alloc_stat_arrays(struct ice_vsi *vsi) { … } /** * ice_vsi_alloc_def - set default values for already allocated VSI * @vsi: ptr to VSI * @ch: ptr to channel */ static int ice_vsi_alloc_def(struct ice_vsi *vsi, struct ice_channel *ch) { … } /** * ice_vsi_alloc - Allocates the next available struct VSI in the PF * @pf: board private structure * * Reserves a VSI index from the PF and allocates an empty VSI structure * without a type. The VSI structure must later be initialized by calling * ice_vsi_cfg(). * * returns a pointer to a VSI on success, NULL on failure. */ struct ice_vsi *ice_vsi_alloc(struct ice_pf *pf) { … } /** * ice_alloc_fd_res - Allocate FD resource for a VSI * @vsi: pointer to the ice_vsi * * This allocates the FD resources * * Returns 0 on success, -EPERM on no-op or -EIO on failure */ static int ice_alloc_fd_res(struct ice_vsi *vsi) { … } /** * ice_vsi_get_qs - Assign queues from PF to VSI * @vsi: the VSI to assign queues to * * Returns 0 on success and a negative value on error */ static int ice_vsi_get_qs(struct ice_vsi *vsi) { … } /** * ice_vsi_put_qs - Release queues from VSI to PF * @vsi: the VSI that is going to release queues */ static void ice_vsi_put_qs(struct ice_vsi *vsi) { … } /** * ice_is_safe_mode * @pf: pointer to the PF struct * * returns true if driver is in safe mode, false otherwise */ bool ice_is_safe_mode(struct ice_pf *pf) { … } /** * ice_is_rdma_ena * @pf: pointer to the PF struct * * returns true if RDMA is currently supported, false otherwise */ bool ice_is_rdma_ena(struct ice_pf *pf) { … } /** * ice_vsi_clean_rss_flow_fld - Delete RSS configuration * @vsi: the VSI being cleaned up * * This function deletes RSS input set for all flows that were configured * for this VSI */ static void ice_vsi_clean_rss_flow_fld(struct ice_vsi *vsi) { … } /** * ice_rss_clean - Delete RSS related VSI structures and configuration * @vsi: the VSI being removed */ static void ice_rss_clean(struct ice_vsi *vsi) { … } /** * ice_vsi_set_rss_params - Setup RSS capabilities per VSI type * @vsi: the VSI being configured */ static void ice_vsi_set_rss_params(struct ice_vsi *vsi) { … } /** * ice_set_dflt_vsi_ctx - Set default VSI context before adding a VSI * @hw: HW structure used to determine the VLAN mode of the device * @ctxt: the VSI context being set * * This initializes a default VSI context for all sections except the Queues. */ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct ice_vsi_ctx *ctxt) { … } /** * ice_vsi_setup_q_map - Setup a VSI queue map * @vsi: the VSI being configured * @ctxt: VSI context structure */ static int ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) { … } /** * ice_set_fd_vsi_ctx - Set FD VSI context before adding a VSI * @ctxt: the VSI context being set * @vsi: the VSI being configured */ static void ice_set_fd_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi) { … } /** * ice_set_rss_vsi_ctx - Set RSS VSI context before adding a VSI * @ctxt: the VSI context being set * @vsi: the VSI being configured */ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi) { … } static void ice_chnl_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt) { … } /** * ice_vsi_is_vlan_pruning_ena - check if VLAN pruning is enabled or not * @vsi: VSI to check whether or not VLAN pruning is enabled. * * returns true if Rx VLAN pruning is enabled and false otherwise. */ static bool ice_vsi_is_vlan_pruning_ena(struct ice_vsi *vsi) { … } /** * ice_vsi_init - Create and initialize a VSI * @vsi: the VSI being configured * @vsi_flags: VSI configuration flags * * Set ICE_FLAG_VSI_INIT to initialize a new VSI context, clear it to * reconfigure an existing context. * * This initializes a VSI context depending on the VSI type to be added and * passes it down to the add_vsi aq command to create a new VSI. */ static int ice_vsi_init(struct ice_vsi *vsi, u32 vsi_flags) { … } /** * ice_vsi_clear_rings - Deallocates the Tx and Rx rings for VSI * @vsi: the VSI having rings deallocated */ static void ice_vsi_clear_rings(struct ice_vsi *vsi) { … } /** * ice_vsi_alloc_rings - Allocates Tx and Rx rings for the VSI * @vsi: VSI which is having rings allocated */ static int ice_vsi_alloc_rings(struct ice_vsi *vsi) { … } /** * ice_vsi_manage_rss_lut - disable/enable RSS * @vsi: the VSI being changed * @ena: boolean value indicating if this is an enable or disable request * * In the event of disable request for RSS, this function will zero out RSS * LUT, while in the event of enable request for RSS, it will reconfigure RSS * LUT. */ void ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena) { … } /** * ice_vsi_cfg_crc_strip - Configure CRC stripping for a VSI * @vsi: VSI to be configured * @disable: set to true to have FCS / CRC in the frame data */ void ice_vsi_cfg_crc_strip(struct ice_vsi *vsi, bool disable) { … } /** * ice_vsi_cfg_rss_lut_key - Configure RSS params for a VSI * @vsi: VSI to be configured */ int ice_vsi_cfg_rss_lut_key(struct ice_vsi *vsi) { … } /** * ice_vsi_set_vf_rss_flow_fld - Sets VF VSI RSS input set for different flows * @vsi: VSI to be configured * * This function will only be called during the VF VSI setup. Upon successful * completion of package download, this function will configure default RSS * input sets for VF VSI. */ static void ice_vsi_set_vf_rss_flow_fld(struct ice_vsi *vsi) { … } static const struct ice_rss_hash_cfg default_rss_cfgs[] = …; /** * ice_vsi_set_rss_flow_fld - Sets RSS input set for different flows * @vsi: VSI to be configured * * This function will only be called after successful download package call * during initialization of PF. Since the downloaded package will erase the * RSS section, this function will configure RSS input sets for different * flow types. The last profile added has the highest priority, therefore 2 * tuple profiles (i.e. IPv4 src/dst) are added before 4 tuple profiles * (i.e. IPv4 src/dst TCP src/dst port). */ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi) { … } /** * ice_pf_state_is_nominal - checks the PF for nominal state * @pf: pointer to PF to check * * Check the PF's state for a collection of bits that would indicate * the PF is in a state that would inhibit normal operation for * driver functionality. * * Returns true if PF is in a nominal state, false otherwise */ bool ice_pf_state_is_nominal(struct ice_pf *pf) { … } /** * ice_update_eth_stats - Update VSI-specific ethernet statistics counters * @vsi: the VSI to be updated */ void ice_update_eth_stats(struct ice_vsi *vsi) { … } /** * ice_write_qrxflxp_cntxt - write/configure QRXFLXP_CNTXT register * @hw: HW pointer * @pf_q: index of the Rx queue in the PF's queue space * @rxdid: flexible descriptor RXDID * @prio: priority for the RXDID for this queue * @ena_ts: true to enable timestamp and false to disable timestamp */ void ice_write_qrxflxp_cntxt(struct ice_hw *hw, u16 pf_q, u32 rxdid, u32 prio, bool ena_ts) { … } /** * ice_intrl_usec_to_reg - convert interrupt rate limit to register value * @intrl: interrupt rate limit in usecs * @gran: interrupt rate limit granularity in usecs * * This function converts a decimal interrupt rate limit in usecs to the format * expected by firmware. */ static u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran) { … } /** * ice_write_intrl - write throttle rate limit to interrupt specific register * @q_vector: pointer to interrupt specific structure * @intrl: throttle rate limit in microseconds to write */ void ice_write_intrl(struct ice_q_vector *q_vector, u8 intrl) { … } static struct ice_q_vector *ice_pull_qvec_from_rc(struct ice_ring_container *rc) { … } /** * __ice_write_itr - write throttle rate to register * @q_vector: pointer to interrupt data structure * @rc: pointer to ring container * @itr: throttle rate in microseconds to write */ static void __ice_write_itr(struct ice_q_vector *q_vector, struct ice_ring_container *rc, u16 itr) { … } /** * ice_write_itr - write throttle rate to queue specific register * @rc: pointer to ring container * @itr: throttle rate in microseconds to write */ void ice_write_itr(struct ice_ring_container *rc, u16 itr) { … } /** * ice_set_q_vector_intrl - set up interrupt rate limiting * @q_vector: the vector to be configured * * Interrupt rate limiting is local to the vector, not per-queue so we must * detect if either ring container has dynamic moderation enabled to decide * what to set the interrupt rate limit to via INTRL settings. In the case that * dynamic moderation is disabled on both, write the value with the cached * setting to make sure INTRL register matches the user visible value. */ void ice_set_q_vector_intrl(struct ice_q_vector *q_vector) { … } /** * ice_vsi_cfg_msix - MSIX mode Interrupt Config in the HW * @vsi: the VSI being configured * * This configures MSIX mode interrupts for the PF VSI, and should not be used * for the VF VSI. */ void ice_vsi_cfg_msix(struct ice_vsi *vsi) { … } /** * ice_vsi_start_all_rx_rings - start/enable all of a VSI's Rx rings * @vsi: the VSI whose rings are to be enabled * * Returns 0 on success and a negative value on error */ int ice_vsi_start_all_rx_rings(struct ice_vsi *vsi) { … } /** * ice_vsi_stop_all_rx_rings - stop/disable all of a VSI's Rx rings * @vsi: the VSI whose rings are to be disabled * * Returns 0 on success and a negative value on error */ int ice_vsi_stop_all_rx_rings(struct ice_vsi *vsi) { … } /** * ice_vsi_stop_tx_rings - Disable Tx rings * @vsi: the VSI being configured * @rst_src: reset source * @rel_vmvf_num: Relative ID of VF/VM * @rings: Tx ring array to be stopped * @count: number of Tx ring array elements */ static int ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, u16 rel_vmvf_num, struct ice_tx_ring **rings, u16 count) { … } /** * ice_vsi_stop_lan_tx_rings - Disable LAN Tx rings * @vsi: the VSI being configured * @rst_src: reset source * @rel_vmvf_num: Relative ID of VF/VM */ int ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, u16 rel_vmvf_num) { … } /** * ice_vsi_stop_xdp_tx_rings - Disable XDP Tx rings * @vsi: the VSI being configured */ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi) { … } /** * ice_vsi_is_rx_queue_active * @vsi: the VSI being configured * * Return true if at least one queue is active. */ bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi) { … } static void ice_vsi_set_tc_cfg(struct ice_vsi *vsi) { … } /** * ice_cfg_sw_lldp - Config switch rules for LLDP packet handling * @vsi: the VSI being configured * @tx: bool to determine Tx or Rx rule * @create: bool to determine create or remove Rule */ void ice_cfg_sw_lldp(struct ice_vsi *vsi, bool tx, bool create) { … } /** * ice_set_agg_vsi - sets up scheduler aggregator node and move VSI into it * @vsi: pointer to the VSI * * This function will allocate new scheduler aggregator now if needed and will * move specified VSI into it. */ static void ice_set_agg_vsi(struct ice_vsi *vsi) { … } static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi) { … } /** * ice_vsi_cfg_def - configure default VSI based on the type * @vsi: pointer to VSI */ static int ice_vsi_cfg_def(struct ice_vsi *vsi) { … } /** * ice_vsi_cfg - configure a previously allocated VSI * @vsi: pointer to VSI */ int ice_vsi_cfg(struct ice_vsi *vsi) { … } /** * ice_vsi_decfg - remove all VSI configuration * @vsi: pointer to VSI */ void ice_vsi_decfg(struct ice_vsi *vsi) { … } /** * ice_vsi_setup - Set up a VSI by a given type * @pf: board private structure * @params: parameters to use when creating the VSI * * This allocates the sw VSI structure and its queue resources. * * Returns pointer to the successfully allocated and configured VSI sw struct on * success, NULL on failure. */ struct ice_vsi * ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params) { … } /** * ice_vsi_release_msix - Clear the queue to Interrupt mapping in HW * @vsi: the VSI being cleaned up */ static void ice_vsi_release_msix(struct ice_vsi *vsi) { … } /** * ice_vsi_free_irq - Free the IRQ association with the OS * @vsi: the VSI being configured */ void ice_vsi_free_irq(struct ice_vsi *vsi) { … } /** * ice_vsi_free_tx_rings - Free Tx resources for VSI queues * @vsi: the VSI having resources freed */ void ice_vsi_free_tx_rings(struct ice_vsi *vsi) { … } /** * ice_vsi_free_rx_rings - Free Rx resources for VSI queues * @vsi: the VSI having resources freed */ void ice_vsi_free_rx_rings(struct ice_vsi *vsi) { … } /** * ice_vsi_close - Shut down a VSI * @vsi: the VSI being shut down */ void ice_vsi_close(struct ice_vsi *vsi) { … } /** * ice_ena_vsi - resume a VSI * @vsi: the VSI being resume * @locked: is the rtnl_lock already held */ int ice_ena_vsi(struct ice_vsi *vsi, bool locked) { … } /** * ice_dis_vsi - pause a VSI * @vsi: the VSI being paused * @locked: is the rtnl_lock already held */ void ice_dis_vsi(struct ice_vsi *vsi, bool locked) { … } /** * ice_vsi_set_napi_queues - associate netdev queues with napi * @vsi: VSI pointer * * Associate queue[s] with napi for all vectors. * The caller must hold rtnl_lock. */ void ice_vsi_set_napi_queues(struct ice_vsi *vsi) { … } /** * ice_vsi_clear_napi_queues - dissociate netdev queues from napi * @vsi: VSI pointer * * Clear the association between all VSI queues queue[s] and napi. * The caller must hold rtnl_lock. */ void ice_vsi_clear_napi_queues(struct ice_vsi *vsi) { … } /** * ice_napi_add - register NAPI handler for the VSI * @vsi: VSI for which NAPI handler is to be registered * * This function is only called in the driver's load path. Registering the NAPI * handler is done in ice_vsi_alloc_q_vector() for all other cases (i.e. resume, * reset/rebuild, etc.) */ void ice_napi_add(struct ice_vsi *vsi) { … } /** * ice_vsi_release - Delete a VSI and free its resources * @vsi: the VSI being removed * * Returns 0 on success or < 0 on error */ int ice_vsi_release(struct ice_vsi *vsi) { … } /** * ice_vsi_rebuild_get_coalesce - get coalesce from all q_vectors * @vsi: VSI connected with q_vectors * @coalesce: array of struct with stored coalesce * * Returns array size. */ static int ice_vsi_rebuild_get_coalesce(struct ice_vsi *vsi, struct ice_coalesce_stored *coalesce) { … } /** * ice_vsi_rebuild_set_coalesce - set coalesce from earlier saved arrays * @vsi: VSI connected with q_vectors * @coalesce: pointer to array of struct with stored coalesce * @size: size of coalesce array * * Before this function, ice_vsi_rebuild_get_coalesce should be called to save * ITR params in arrays. If size is 0 or coalesce wasn't stored set coalesce * to default value. */ static void ice_vsi_rebuild_set_coalesce(struct ice_vsi *vsi, struct ice_coalesce_stored *coalesce, int size) { … } /** * ice_vsi_realloc_stat_arrays - Frees unused stat structures or alloc new ones * @vsi: VSI pointer */ static int ice_vsi_realloc_stat_arrays(struct ice_vsi *vsi) { … } /** * ice_vsi_rebuild - Rebuild VSI after reset * @vsi: VSI to be rebuild * @vsi_flags: flags used for VSI rebuild flow * * Set vsi_flags to ICE_VSI_FLAG_INIT to initialize a new VSI, or * ICE_VSI_FLAG_NO_INIT to rebuild an existing VSI in hardware. * * Returns 0 on success and negative value on failure */ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) { … } /** * ice_is_reset_in_progress - check for a reset in progress * @state: PF state field */ bool ice_is_reset_in_progress(unsigned long *state) { … } /** * ice_wait_for_reset - Wait for driver to finish reset and rebuild * @pf: pointer to the PF structure * @timeout: length of time to wait, in jiffies * * Wait (sleep) for a short time until the driver finishes cleaning up from * a device reset. The caller must be able to sleep. Use this to delay * operations that could fail while the driver is cleaning up after a device * reset. * * Returns 0 on success, -EBUSY if the reset is not finished within the * timeout, and -ERESTARTSYS if the thread was interrupted. */ int ice_wait_for_reset(struct ice_pf *pf, unsigned long timeout) { … } /** * ice_vsi_update_q_map - update our copy of the VSI info with new queue map * @vsi: VSI being configured * @ctx: the context buffer returned from AQ VSI update command */ static void ice_vsi_update_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctx) { … } /** * ice_vsi_cfg_netdev_tc - Setup the netdev TC configuration * @vsi: the VSI being configured * @ena_tc: TC map to be enabled */ void ice_vsi_cfg_netdev_tc(struct ice_vsi *vsi, u8 ena_tc) { … } /** * ice_vsi_setup_q_map_mqprio - Prepares mqprio based tc_config * @vsi: the VSI being configured, * @ctxt: VSI context structure * @ena_tc: number of traffic classes to enable * * Prepares VSI tc_config to have queue configurations based on MQPRIO options. */ static int ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt, u8 ena_tc) { … } /** * ice_vsi_cfg_tc - Configure VSI Tx Sched for given TC map * @vsi: VSI to be configured * @ena_tc: TC bitmap * * VSI queues expected to be quiesced before calling this function */ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc) { … } /** * ice_update_ring_stats - Update ring statistics * @stats: stats to be updated * @pkts: number of processed packets * @bytes: number of processed bytes * * This function assumes that caller has acquired a u64_stats_sync lock. */ static void ice_update_ring_stats(struct ice_q_stats *stats, u64 pkts, u64 bytes) { … } /** * ice_update_tx_ring_stats - Update Tx ring specific counters * @tx_ring: ring to update * @pkts: number of processed packets * @bytes: number of processed bytes */ void ice_update_tx_ring_stats(struct ice_tx_ring *tx_ring, u64 pkts, u64 bytes) { … } /** * ice_update_rx_ring_stats - Update Rx ring specific counters * @rx_ring: ring to update * @pkts: number of processed packets * @bytes: number of processed bytes */ void ice_update_rx_ring_stats(struct ice_rx_ring *rx_ring, u64 pkts, u64 bytes) { … } /** * ice_is_dflt_vsi_in_use - check if the default forwarding VSI is being used * @pi: port info of the switch with default VSI * * Return true if the there is a single VSI in default forwarding VSI list */ bool ice_is_dflt_vsi_in_use(struct ice_port_info *pi) { … } /** * ice_is_vsi_dflt_vsi - check if the VSI passed in is the default VSI * @vsi: VSI to compare against default forwarding VSI * * If this VSI passed in is the default forwarding VSI then return true, else * return false */ bool ice_is_vsi_dflt_vsi(struct ice_vsi *vsi) { … } /** * ice_set_dflt_vsi - set the default forwarding VSI * @vsi: VSI getting set as the default forwarding VSI on the switch * * If the VSI passed in is already the default VSI and it's enabled just return * success. * * Otherwise try to set the VSI passed in as the switch's default VSI and * return the result. */ int ice_set_dflt_vsi(struct ice_vsi *vsi) { … } /** * ice_clear_dflt_vsi - clear the default forwarding VSI * @vsi: VSI to remove from filter list * * If the switch has no default VSI or it's not enabled then return error. * * Otherwise try to clear the default VSI and return the result. */ int ice_clear_dflt_vsi(struct ice_vsi *vsi) { … } /** * ice_get_link_speed_mbps - get link speed in Mbps * @vsi: the VSI whose link speed is being queried * * Return current VSI link speed and 0 if the speed is unknown. */ int ice_get_link_speed_mbps(struct ice_vsi *vsi) { … } /** * ice_get_link_speed_kbps - get link speed in Kbps * @vsi: the VSI whose link speed is being queried * * Return current VSI link speed and 0 if the speed is unknown. */ int ice_get_link_speed_kbps(struct ice_vsi *vsi) { … } /** * ice_set_min_bw_limit - setup minimum BW limit for Tx based on min_tx_rate * @vsi: VSI to be configured * @min_tx_rate: min Tx rate in Kbps to be configured as BW limit * * If the min_tx_rate is specified as 0 that means to clear the minimum BW limit * profile, otherwise a non-zero value will force a minimum BW limit for the VSI * on TC 0. */ int ice_set_min_bw_limit(struct ice_vsi *vsi, u64 min_tx_rate) { … } /** * ice_set_max_bw_limit - setup maximum BW limit for Tx based on max_tx_rate * @vsi: VSI to be configured * @max_tx_rate: max Tx rate in Kbps to be configured as BW limit * * If the max_tx_rate is specified as 0 that means to clear the maximum BW limit * profile, otherwise a non-zero value will force a maximum BW limit for the VSI * on TC 0. */ int ice_set_max_bw_limit(struct ice_vsi *vsi, u64 max_tx_rate) { … } /** * ice_set_link - turn on/off physical link * @vsi: VSI to modify physical link on * @ena: turn on/off physical link */ int ice_set_link(struct ice_vsi *vsi, bool ena) { … } /** * ice_vsi_add_vlan_zero - add VLAN 0 filter(s) for this VSI * @vsi: VSI used to add VLAN filters * * In Single VLAN Mode (SVM), single VLAN filters via ICE_SW_LKUP_VLAN are based * on the inner VLAN ID, so the VLAN TPID (i.e. 0x8100 or 0x888a8) doesn't * matter. In Double VLAN Mode (DVM), outer/single VLAN filters via * ICE_SW_LKUP_VLAN are based on the outer/single VLAN ID + VLAN TPID. * * For both modes add a VLAN 0 + no VLAN TPID filter to handle untagged traffic * when VLAN pruning is enabled. Also, this handles VLAN 0 priority tagged * traffic in SVM, since the VLAN TPID isn't part of filtering. * * If DVM is enabled then an explicit VLAN 0 + VLAN TPID filter needs to be * added to allow VLAN 0 priority tagged traffic in DVM, since the VLAN TPID is * part of filtering. */ int ice_vsi_add_vlan_zero(struct ice_vsi *vsi) { … } /** * ice_vsi_del_vlan_zero - delete VLAN 0 filter(s) for this VSI * @vsi: VSI used to add VLAN filters * * Delete the VLAN 0 filters in the same manner that they were added in * ice_vsi_add_vlan_zero. */ int ice_vsi_del_vlan_zero(struct ice_vsi *vsi) { … } /** * ice_vsi_num_zero_vlans - get number of VLAN 0 filters based on VLAN mode * @vsi: VSI used to get the VLAN mode * * If DVM is enabled then 2 VLAN 0 filters are added, else if SVM is enabled * then 1 VLAN 0 filter is added. See ice_vsi_add_vlan_zero for more details. */ static u16 ice_vsi_num_zero_vlans(struct ice_vsi *vsi) { … } /** * ice_vsi_has_non_zero_vlans - check if VSI has any non-zero VLANs * @vsi: VSI used to determine if any non-zero VLANs have been added */ bool ice_vsi_has_non_zero_vlans(struct ice_vsi *vsi) { … } /** * ice_vsi_num_non_zero_vlans - get the number of non-zero VLANs for this VSI * @vsi: VSI used to get the number of non-zero VLANs added */ u16 ice_vsi_num_non_zero_vlans(struct ice_vsi *vsi) { … } /** * ice_is_feature_supported * @pf: pointer to the struct ice_pf instance * @f: feature enum to be checked * * returns true if feature is supported, false otherwise */ bool ice_is_feature_supported(struct ice_pf *pf, enum ice_feature f) { … } /** * ice_set_feature_support * @pf: pointer to the struct ice_pf instance * @f: feature enum to set */ void ice_set_feature_support(struct ice_pf *pf, enum ice_feature f) { … } /** * ice_clear_feature_support * @pf: pointer to the struct ice_pf instance * @f: feature enum to clear */ void ice_clear_feature_support(struct ice_pf *pf, enum ice_feature f) { … } /** * ice_init_feature_support * @pf: pointer to the struct ice_pf instance * * called during init to setup supported feature */ void ice_init_feature_support(struct ice_pf *pf) { … } /** * ice_vsi_update_security - update security block in VSI * @vsi: pointer to VSI structure * @fill: function pointer to fill ctx */ int ice_vsi_update_security(struct ice_vsi *vsi, void (*fill)(struct ice_vsi_ctx *)) { … } /** * ice_vsi_ctx_set_antispoof - set antispoof function in VSI ctx * @ctx: pointer to VSI ctx structure */ void ice_vsi_ctx_set_antispoof(struct ice_vsi_ctx *ctx) { … } /** * ice_vsi_ctx_clear_antispoof - clear antispoof function in VSI ctx * @ctx: pointer to VSI ctx structure */ void ice_vsi_ctx_clear_antispoof(struct ice_vsi_ctx *ctx) { … } /** * ice_vsi_ctx_set_allow_override - allow destination override on VSI * @ctx: pointer to VSI ctx structure */ void ice_vsi_ctx_set_allow_override(struct ice_vsi_ctx *ctx) { … } /** * ice_vsi_ctx_clear_allow_override - turn off destination override on VSI * @ctx: pointer to VSI ctx structure */ void ice_vsi_ctx_clear_allow_override(struct ice_vsi_ctx *ctx) { … } /** * ice_vsi_update_local_lb - update sw block in VSI with local loopback bit * @vsi: pointer to VSI structure * @set: set or unset the bit */ int ice_vsi_update_local_lb(struct ice_vsi *vsi, bool set) { … }