// SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2022, Intel Corporation. */ #include "ice_virtchnl.h" #include "ice_vf_lib_private.h" #include "ice.h" #include "ice_base.h" #include "ice_lib.h" #include "ice_fltr.h" #include "ice_virtchnl_allowlist.h" #include "ice_vf_vsi_vlan_ops.h" #include "ice_vlan.h" #include "ice_flex_pipe.h" #include "ice_dcb_lib.h" #define FIELD_SELECTOR(proto_hdr_field) … struct ice_vc_hdr_match_type { … }; static const struct ice_vc_hdr_match_type ice_vc_hdr_list[] = …; struct ice_vc_hash_field_match_type { … }; static const struct ice_vc_hash_field_match_type ice_vc_hash_field_list[] = …; /** * ice_vc_vf_broadcast - Broadcast a message to all VFs on PF * @pf: pointer to the PF structure * @v_opcode: operation code * @v_retval: return value * @msg: pointer to the msg buffer * @msglen: msg length */ static void ice_vc_vf_broadcast(struct ice_pf *pf, enum virtchnl_ops v_opcode, enum virtchnl_status_code v_retval, u8 *msg, u16 msglen) { … } /** * ice_set_pfe_link - Set the link speed/status of the virtchnl_pf_event * @vf: pointer to the VF structure * @pfe: pointer to the virtchnl_pf_event to set link speed/status for * @ice_link_speed: link speed specified by ICE_AQ_LINK_SPEED_* * @link_up: whether or not to set the link up/down */ static void ice_set_pfe_link(struct ice_vf *vf, struct virtchnl_pf_event *pfe, int ice_link_speed, bool link_up) { … } /** * ice_vc_notify_vf_link_state - Inform a VF of link status * @vf: pointer to the VF structure * * send a link status message to a single VF */ void ice_vc_notify_vf_link_state(struct ice_vf *vf) { … } /** * ice_vc_notify_link_state - Inform all VFs on a PF of link status * @pf: pointer to the PF structure */ void ice_vc_notify_link_state(struct ice_pf *pf) { … } /** * ice_vc_notify_reset - Send pending reset message to all VFs * @pf: pointer to the PF structure * * indicate a pending reset to all VFs on a given PF */ void ice_vc_notify_reset(struct ice_pf *pf) { … } /** * ice_vc_send_msg_to_vf - Send message to VF * @vf: pointer to the VF info * @v_opcode: virtual channel opcode * @v_retval: virtual channel return value * @msg: pointer to the msg buffer * @msglen: msg length * * send msg to VF */ int ice_vc_send_msg_to_vf(struct ice_vf *vf, u32 v_opcode, enum virtchnl_status_code v_retval, u8 *msg, u16 msglen) { … } /** * ice_vc_get_ver_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * called from the VF to request the API version used by the PF */ static int ice_vc_get_ver_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_get_max_frame_size - get max frame size allowed for VF * @vf: VF used to determine max frame size * * Max frame size is determined based on the current port's max frame size and * whether a port VLAN is configured on this VF. The VF is not aware whether * it's in a port VLAN so the PF needs to account for this in max frame size * checks and sending the max frame size to the VF. */ static u16 ice_vc_get_max_frame_size(struct ice_vf *vf) { … } /** * ice_vc_get_vlan_caps * @hw: pointer to the hw * @vf: pointer to the VF info * @vsi: pointer to the VSI * @driver_caps: current driver caps * * Return 0 if there is no VLAN caps supported, or VLAN caps value */ static u32 ice_vc_get_vlan_caps(struct ice_hw *hw, struct ice_vf *vf, struct ice_vsi *vsi, u32 driver_caps) { … } /** * ice_vc_get_vf_res_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * called from the VF to request its resources */ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_reset_vf_msg * @vf: pointer to the VF info * * called from the VF to reset itself, * unlike other virtchnl messages, PF driver * doesn't send the response back to the VF */ static void ice_vc_reset_vf_msg(struct ice_vf *vf) { … } /** * ice_vc_isvalid_vsi_id * @vf: pointer to the VF info * @vsi_id: VF relative VSI ID * * check for the valid VSI ID */ bool ice_vc_isvalid_vsi_id(struct ice_vf *vf, u16 vsi_id) { … } /** * ice_vc_isvalid_q_id * @vsi: VSI to check queue ID against * @qid: VSI relative queue ID * * check for the valid queue ID */ static bool ice_vc_isvalid_q_id(struct ice_vsi *vsi, u8 qid) { … } /** * ice_vc_isvalid_ring_len * @ring_len: length of ring * * check for the valid ring count, should be multiple of ICE_REQ_DESC_MULTIPLE * or zero */ static bool ice_vc_isvalid_ring_len(u16 ring_len) { … } /** * ice_vc_validate_pattern * @vf: pointer to the VF info * @proto: virtchnl protocol headers * * validate the pattern is supported or not. * * Return: true on success, false on error. */ bool ice_vc_validate_pattern(struct ice_vf *vf, struct virtchnl_proto_hdrs *proto) { … } /** * ice_vc_parse_rss_cfg - parses hash fields and headers from * a specific virtchnl RSS cfg * @hw: pointer to the hardware * @rss_cfg: pointer to the virtchnl RSS cfg * @hash_cfg: pointer to the HW hash configuration * * Return true if all the protocol header and hash fields in the RSS cfg could * be parsed, else return false * * This function parses the virtchnl RSS cfg to be the intended * hash fields and the intended header for RSS configuration */ static bool ice_vc_parse_rss_cfg(struct ice_hw *hw, struct virtchnl_rss_cfg *rss_cfg, struct ice_rss_hash_cfg *hash_cfg) { … } /** * ice_vf_adv_rss_offload_ena - determine if capabilities support advanced * RSS offloads * @caps: VF driver negotiated capabilities * * Return true if VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF capability is set, * else return false */ static bool ice_vf_adv_rss_offload_ena(u32 caps) { … } /** * ice_vc_handle_rss_cfg * @vf: pointer to the VF info * @msg: pointer to the message buffer * @add: add a RSS config if true, otherwise delete a RSS config * * This function adds/deletes a RSS config */ static int ice_vc_handle_rss_cfg(struct ice_vf *vf, u8 *msg, bool add) { … } /** * ice_vc_config_rss_key * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * Configure the VF's RSS key */ static int ice_vc_config_rss_key(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_config_rss_lut * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * Configure the VF's RSS LUT */ static int ice_vc_config_rss_lut(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_config_rss_hfunc * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * Configure the VF's RSS Hash function */ static int ice_vc_config_rss_hfunc(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_cfg_promiscuous_mode_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * called from the VF to configure VF VSIs promiscuous mode */ static int ice_vc_cfg_promiscuous_mode_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_get_stats_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * called from the VF to get VSI stats */ static int ice_vc_get_stats_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_validate_vqs_bitmaps - validate Rx/Tx queue bitmaps from VIRTCHNL * @vqs: virtchnl_queue_select structure containing bitmaps to validate * * Return true on successful validation, else false */ static bool ice_vc_validate_vqs_bitmaps(struct virtchnl_queue_select *vqs) { … } /** * ice_vf_ena_txq_interrupt - enable Tx queue interrupt via QINT_TQCTL * @vsi: VSI of the VF to configure * @q_idx: VF queue index used to determine the queue in the PF's space */ static void ice_vf_ena_txq_interrupt(struct ice_vsi *vsi, u32 q_idx) { … } /** * ice_vf_ena_rxq_interrupt - enable Tx queue interrupt via QINT_RQCTL * @vsi: VSI of the VF to configure * @q_idx: VF queue index used to determine the queue in the PF's space */ static void ice_vf_ena_rxq_interrupt(struct ice_vsi *vsi, u32 q_idx) { … } /** * ice_vc_ena_qs_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * called from the VF to enable all or specific queue(s) */ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vf_vsi_dis_single_txq - disable a single Tx queue * @vf: VF to disable queue for * @vsi: VSI for the VF * @q_id: VF relative (0-based) queue ID * * Attempt to disable the Tx queue passed in. If the Tx queue was successfully * disabled then clear q_id bit in the enabled queues bitmap and return * success. Otherwise return error. */ static int ice_vf_vsi_dis_single_txq(struct ice_vf *vf, struct ice_vsi *vsi, u16 q_id) { … } /** * ice_vc_dis_qs_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * called from the VF to disable all or specific queue(s) */ static int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_cfg_interrupt * @vf: pointer to the VF info * @vsi: the VSI being configured * @map: vector map for mapping vectors to queues * @q_vector: structure for interrupt vector * configure the IRQ to queue map */ static enum virtchnl_status_code ice_cfg_interrupt(struct ice_vf *vf, struct ice_vsi *vsi, struct virtchnl_vector_map *map, struct ice_q_vector *q_vector) { … } /** * ice_vc_cfg_irq_map_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * called from the VF to configure the IRQ to queue map */ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_cfg_qs_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * called from the VF to configure the Rx/Tx queues */ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_can_vf_change_mac * @vf: pointer to the VF info * * Return true if the VF is allowed to change its MAC filters, false otherwise */ static bool ice_can_vf_change_mac(struct ice_vf *vf) { … } /** * ice_vc_ether_addr_type - get type of virtchnl_ether_addr * @vc_ether_addr: used to extract the type */ static u8 ice_vc_ether_addr_type(struct virtchnl_ether_addr *vc_ether_addr) { … } /** * ice_is_vc_addr_legacy - check if the MAC address is from an older VF * @vc_ether_addr: VIRTCHNL structure that contains MAC and type */ static bool ice_is_vc_addr_legacy(struct virtchnl_ether_addr *vc_ether_addr) { … } /** * ice_is_vc_addr_primary - check if the MAC address is the VF's primary MAC * @vc_ether_addr: VIRTCHNL structure that contains MAC and type * * This function should only be called when the MAC address in * virtchnl_ether_addr is a valid unicast MAC */ static bool ice_is_vc_addr_primary(struct virtchnl_ether_addr __maybe_unused *vc_ether_addr) { … } /** * ice_vfhw_mac_add - update the VF's cached hardware MAC if allowed * @vf: VF to update * @vc_ether_addr: structure from VIRTCHNL with MAC to add */ static void ice_vfhw_mac_add(struct ice_vf *vf, struct virtchnl_ether_addr *vc_ether_addr) { … } /** * ice_vc_add_mac_addr - attempt to add the MAC address passed in * @vf: pointer to the VF info * @vsi: pointer to the VF's VSI * @vc_ether_addr: VIRTCHNL MAC address structure used to add MAC */ static int ice_vc_add_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi, struct virtchnl_ether_addr *vc_ether_addr) { … } /** * ice_is_legacy_umac_expired - check if last added legacy unicast MAC expired * @last_added_umac: structure used to check expiration */ static bool ice_is_legacy_umac_expired(struct ice_time_mac *last_added_umac) { … } /** * ice_update_legacy_cached_mac - update cached hardware MAC for legacy VF * @vf: VF to update * @vc_ether_addr: structure from VIRTCHNL with MAC to check * * only update cached hardware MAC for legacy VF drivers on delete * because we cannot guarantee order/type of MAC from the VF driver */ static void ice_update_legacy_cached_mac(struct ice_vf *vf, struct virtchnl_ether_addr *vc_ether_addr) { … } /** * ice_vfhw_mac_del - update the VF's cached hardware MAC if allowed * @vf: VF to update * @vc_ether_addr: structure from VIRTCHNL with MAC to delete */ static void ice_vfhw_mac_del(struct ice_vf *vf, struct virtchnl_ether_addr *vc_ether_addr) { … } /** * ice_vc_del_mac_addr - attempt to delete the MAC address passed in * @vf: pointer to the VF info * @vsi: pointer to the VF's VSI * @vc_ether_addr: VIRTCHNL MAC address structure used to delete MAC */ static int ice_vc_del_mac_addr(struct ice_vf *vf, struct ice_vsi *vsi, struct virtchnl_ether_addr *vc_ether_addr) { … } /** * ice_vc_handle_mac_addr_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * @set: true if MAC filters are being set, false otherwise * * add guest MAC address filter */ static int ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set) { … } /** * ice_vc_add_mac_addr_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * add guest MAC address filter */ static int ice_vc_add_mac_addr_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_del_mac_addr_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * remove guest MAC address filter */ static int ice_vc_del_mac_addr_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_request_qs_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * VFs get a default number of queues but can use this message to request a * different number. If the request is successful, PF will reset the VF and * return 0. If unsuccessful, PF will send message informing VF of number of * available queue pairs via virtchnl message response to VF. */ static int ice_vc_request_qs_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vf_vlan_offload_ena - determine if capabilities support VLAN offloads * @caps: VF driver negotiated capabilities * * Return true if VIRTCHNL_VF_OFFLOAD_VLAN capability is set, else return false */ static bool ice_vf_vlan_offload_ena(u32 caps) { … } /** * ice_is_vlan_promisc_allowed - check if VLAN promiscuous config is allowed * @vf: VF used to determine if VLAN promiscuous config is allowed */ static bool ice_is_vlan_promisc_allowed(struct ice_vf *vf) { … } /** * ice_vf_ena_vlan_promisc - Enable Tx/Rx VLAN promiscuous for the VLAN * @vsi: VF's VSI used to enable VLAN promiscuous mode * @vlan: VLAN used to enable VLAN promiscuous * * This function should only be called if VLAN promiscuous mode is allowed, * which can be determined via ice_is_vlan_promisc_allowed(). */ static int ice_vf_ena_vlan_promisc(struct ice_vsi *vsi, struct ice_vlan *vlan) { … } /** * ice_vf_dis_vlan_promisc - Disable Tx/Rx VLAN promiscuous for the VLAN * @vsi: VF's VSI used to disable VLAN promiscuous mode for * @vlan: VLAN used to disable VLAN promiscuous * * This function should only be called if VLAN promiscuous mode is allowed, * which can be determined via ice_is_vlan_promisc_allowed(). */ static int ice_vf_dis_vlan_promisc(struct ice_vsi *vsi, struct ice_vlan *vlan) { … } /** * ice_vf_has_max_vlans - check if VF already has the max allowed VLAN filters * @vf: VF to check against * @vsi: VF's VSI * * If the VF is trusted then the VF is allowed to add as many VLANs as it * wants to, so return false. * * When the VF is untrusted compare the number of non-zero VLANs + 1 to the max * allowed VLANs for an untrusted VF. Return the result of this comparison. */ static bool ice_vf_has_max_vlans(struct ice_vf *vf, struct ice_vsi *vsi) { … } /** * ice_vc_process_vlan_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * @add_v: Add VLAN if true, otherwise delete VLAN * * Process virtchnl op to add or remove programmed guest VLAN ID */ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v) { … } /** * ice_vc_add_vlan_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * Add and program guest VLAN ID */ static int ice_vc_add_vlan_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_remove_vlan_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * remove programmed guest VLAN ID */ static int ice_vc_remove_vlan_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vsi_is_rxq_crc_strip_dis - check if Rx queue CRC strip is disabled or not * @vsi: pointer to the VF VSI info */ static bool ice_vsi_is_rxq_crc_strip_dis(struct ice_vsi *vsi) { … } /** * ice_vc_ena_vlan_stripping * @vf: pointer to the VF info * * Enable VLAN header stripping for a given VF */ static int ice_vc_ena_vlan_stripping(struct ice_vf *vf) { … } /** * ice_vc_dis_vlan_stripping * @vf: pointer to the VF info * * Disable VLAN header stripping for a given VF */ static int ice_vc_dis_vlan_stripping(struct ice_vf *vf) { … } /** * ice_vc_get_rss_hena - return the RSS HENA bits allowed by the hardware * @vf: pointer to the VF info */ static int ice_vc_get_rss_hena(struct ice_vf *vf) { … } /** * ice_vc_set_rss_hena - set RSS HENA bits for the VF * @vf: pointer to the VF info * @msg: pointer to the msg buffer */ static int ice_vc_set_rss_hena(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_query_rxdid - query RXDID supported by DDP package * @vf: pointer to VF info * * Called from VF to query a bitmap of supported flexible * descriptor RXDIDs of a DDP package. */ static int ice_vc_query_rxdid(struct ice_vf *vf) { … } /** * ice_vf_init_vlan_stripping - enable/disable VLAN stripping on initialization * @vf: VF to enable/disable VLAN stripping for on initialization * * Set the default for VLAN stripping based on whether a port VLAN is configured * and the current VLAN mode of the device. */ static int ice_vf_init_vlan_stripping(struct ice_vf *vf) { … } static u16 ice_vc_get_max_vlan_fltrs(struct ice_vf *vf) { … } /** * ice_vf_outer_vlan_not_allowed - check if outer VLAN can be used * @vf: VF that being checked for * * When the device is in double VLAN mode, check whether or not the outer VLAN * is allowed. */ static bool ice_vf_outer_vlan_not_allowed(struct ice_vf *vf) { … } /** * ice_vc_set_dvm_caps - set VLAN capabilities when the device is in DVM * @vf: VF that capabilities are being set for * @caps: VLAN capabilities to populate * * Determine VLAN capabilities support based on whether a port VLAN is * configured. If a port VLAN is configured then the VF should use the inner * filtering/offload capabilities since the port VLAN is using the outer VLAN * capabilies. */ static void ice_vc_set_dvm_caps(struct ice_vf *vf, struct virtchnl_vlan_caps *caps) { … } /** * ice_vc_set_svm_caps - set VLAN capabilities when the device is in SVM * @vf: VF that capabilities are being set for * @caps: VLAN capabilities to populate * * Determine VLAN capabilities support based on whether a port VLAN is * configured. If a port VLAN is configured then the VF does not have any VLAN * filtering or offload capabilities since the port VLAN is using the inner VLAN * capabilities in single VLAN mode (SVM). Otherwise allow the VF to use inner * VLAN fitlering and offload capabilities. */ static void ice_vc_set_svm_caps(struct ice_vf *vf, struct virtchnl_vlan_caps *caps) { … } /** * ice_vc_get_offload_vlan_v2_caps - determine VF's VLAN capabilities * @vf: VF to determine VLAN capabilities for * * This will only be called if the VF and PF successfully negotiated * VIRTCHNL_VF_OFFLOAD_VLAN_V2. * * Set VLAN capabilities based on the current VLAN mode and whether a port VLAN * is configured or not. */ static int ice_vc_get_offload_vlan_v2_caps(struct ice_vf *vf) { … } /** * ice_vc_validate_vlan_tpid - validate VLAN TPID * @filtering_caps: negotiated/supported VLAN filtering capabilities * @tpid: VLAN TPID used for validation * * Convert the VLAN TPID to a VIRTCHNL_VLAN_ETHERTYPE_* and then compare against * the negotiated/supported filtering caps to see if the VLAN TPID is valid. */ static bool ice_vc_validate_vlan_tpid(u16 filtering_caps, u16 tpid) { … } /** * ice_vc_is_valid_vlan - validate the virtchnl_vlan * @vc_vlan: virtchnl_vlan to validate * * If the VLAN TCI and VLAN TPID are 0, then this filter is invalid, so return * false. Otherwise return true. */ static bool ice_vc_is_valid_vlan(struct virtchnl_vlan *vc_vlan) { … } /** * ice_vc_validate_vlan_filter_list - validate the filter list from the VF * @vfc: negotiated/supported VLAN filtering capabilities * @vfl: VLAN filter list from VF to validate * * Validate all of the filters in the VLAN filter list from the VF. If any of * the checks fail then return false. Otherwise return true. */ static bool ice_vc_validate_vlan_filter_list(struct virtchnl_vlan_filtering_caps *vfc, struct virtchnl_vlan_filter_list_v2 *vfl) { … } /** * ice_vc_to_vlan - transform from struct virtchnl_vlan to struct ice_vlan * @vc_vlan: struct virtchnl_vlan to transform */ static struct ice_vlan ice_vc_to_vlan(struct virtchnl_vlan *vc_vlan) { … } /** * ice_vc_vlan_action - action to perform on the virthcnl_vlan * @vsi: VF's VSI used to perform the action * @vlan_action: function to perform the action with (i.e. add/del) * @vlan: VLAN filter to perform the action with */ static int ice_vc_vlan_action(struct ice_vsi *vsi, int (*vlan_action)(struct ice_vsi *, struct ice_vlan *), struct ice_vlan *vlan) { … } /** * ice_vc_del_vlans - delete VLAN(s) from the virtchnl filter list * @vf: VF used to delete the VLAN(s) * @vsi: VF's VSI used to delete the VLAN(s) * @vfl: virthchnl filter list used to delete the filters */ static int ice_vc_del_vlans(struct ice_vf *vf, struct ice_vsi *vsi, struct virtchnl_vlan_filter_list_v2 *vfl) { … } /** * ice_vc_remove_vlan_v2_msg - virtchnl handler for VIRTCHNL_OP_DEL_VLAN_V2 * @vf: VF the message was received from * @msg: message received from the VF */ static int ice_vc_remove_vlan_v2_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_add_vlans - add VLAN(s) from the virtchnl filter list * @vf: VF used to add the VLAN(s) * @vsi: VF's VSI used to add the VLAN(s) * @vfl: virthchnl filter list used to add the filters */ static int ice_vc_add_vlans(struct ice_vf *vf, struct ice_vsi *vsi, struct virtchnl_vlan_filter_list_v2 *vfl) { … } /** * ice_vc_validate_add_vlan_filter_list - validate add filter list from the VF * @vsi: VF VSI used to get number of existing VLAN filters * @vfc: negotiated/supported VLAN filtering capabilities * @vfl: VLAN filter list from VF to validate * * Validate all of the filters in the VLAN filter list from the VF during the * VIRTCHNL_OP_ADD_VLAN_V2 opcode. If any of the checks fail then return false. * Otherwise return true. */ static bool ice_vc_validate_add_vlan_filter_list(struct ice_vsi *vsi, struct virtchnl_vlan_filtering_caps *vfc, struct virtchnl_vlan_filter_list_v2 *vfl) { … } /** * ice_vc_add_vlan_v2_msg - virtchnl handler for VIRTCHNL_OP_ADD_VLAN_V2 * @vf: VF the message was received from * @msg: message received from the VF */ static int ice_vc_add_vlan_v2_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_valid_vlan_setting - validate VLAN setting * @negotiated_settings: negotiated VLAN settings during VF init * @ethertype_setting: ethertype(s) requested for the VLAN setting */ static bool ice_vc_valid_vlan_setting(u32 negotiated_settings, u32 ethertype_setting) { … } /** * ice_vc_valid_vlan_setting_msg - validate the VLAN setting message * @caps: negotiated VLAN settings during VF init * @msg: message to validate * * Used to validate any VLAN virtchnl message sent as a * virtchnl_vlan_setting structure. Validates the message against the * negotiated/supported caps during VF driver init. */ static bool ice_vc_valid_vlan_setting_msg(struct virtchnl_vlan_supported_caps *caps, struct virtchnl_vlan_setting *msg) { … } /** * ice_vc_get_tpid - transform from VIRTCHNL_VLAN_ETHERTYPE_* to VLAN TPID * @ethertype_setting: VIRTCHNL_VLAN_ETHERTYPE_* used to get VLAN TPID * @tpid: VLAN TPID to populate */ static int ice_vc_get_tpid(u32 ethertype_setting, u16 *tpid) { … } /** * ice_vc_ena_vlan_offload - enable VLAN offload based on the ethertype_setting * @vsi: VF's VSI used to enable the VLAN offload * @ena_offload: function used to enable the VLAN offload * @ethertype_setting: VIRTCHNL_VLAN_ETHERTYPE_* to enable offloads for */ static int ice_vc_ena_vlan_offload(struct ice_vsi *vsi, int (*ena_offload)(struct ice_vsi *vsi, u16 tpid), u32 ethertype_setting) { … } #define ICE_L2TSEL_QRX_CONTEXT_REG_IDX … #define ICE_L2TSEL_BIT_OFFSET … enum ice_l2tsel { … }; /** * ice_vsi_update_l2tsel - update l2tsel field for all Rx rings on this VSI * @vsi: VSI used to update l2tsel on * @l2tsel: l2tsel setting requested * * Use the l2tsel setting to update all of the Rx queue context bits for l2tsel. * This will modify which descriptor field the first offloaded VLAN will be * stripped into. */ static void ice_vsi_update_l2tsel(struct ice_vsi *vsi, enum ice_l2tsel l2tsel) { … } /** * ice_vc_ena_vlan_stripping_v2_msg * @vf: VF the message was received from * @msg: message received from the VF * * virthcnl handler for VIRTCHNL_OP_ENABLE_VLAN_STRIPPING_V2 */ static int ice_vc_ena_vlan_stripping_v2_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_dis_vlan_stripping_v2_msg * @vf: VF the message was received from * @msg: message received from the VF * * virthcnl handler for VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2 */ static int ice_vc_dis_vlan_stripping_v2_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_ena_vlan_insertion_v2_msg * @vf: VF the message was received from * @msg: message received from the VF * * virthcnl handler for VIRTCHNL_OP_ENABLE_VLAN_INSERTION_V2 */ static int ice_vc_ena_vlan_insertion_v2_msg(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_dis_vlan_insertion_v2_msg * @vf: VF the message was received from * @msg: message received from the VF * * virthcnl handler for VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2 */ static int ice_vc_dis_vlan_insertion_v2_msg(struct ice_vf *vf, u8 *msg) { … } static const struct ice_virtchnl_ops ice_virtchnl_dflt_ops = …; /** * ice_virtchnl_set_dflt_ops - Switch to default virtchnl ops * @vf: the VF to switch ops */ void ice_virtchnl_set_dflt_ops(struct ice_vf *vf) { … } /** * ice_vc_repr_add_mac * @vf: pointer to VF * @msg: virtchannel message * * When port representors are created, we do not add MAC rule * to firmware, we store it so that PF could report same * MAC as VF. */ static int ice_vc_repr_add_mac(struct ice_vf *vf, u8 *msg) { … } /** * ice_vc_repr_del_mac - response with success for deleting MAC * @vf: pointer to VF * @msg: virtchannel message * * Respond with success to not break normal VF flow. * For legacy VF driver try to update cached MAC address. */ static int ice_vc_repr_del_mac(struct ice_vf __always_unused *vf, u8 __always_unused *msg) { … } static int ice_vc_repr_cfg_promiscuous_mode(struct ice_vf *vf, u8 __always_unused *msg) { … } static const struct ice_virtchnl_ops ice_virtchnl_repr_ops = …; /** * ice_virtchnl_set_repr_ops - Switch to representor virtchnl ops * @vf: the VF to switch ops */ void ice_virtchnl_set_repr_ops(struct ice_vf *vf) { … } /** * ice_is_malicious_vf - check if this vf might be overflowing mailbox * @vf: the VF to check * @mbxdata: data about the state of the mailbox * * Detect if a given VF might be malicious and attempting to overflow the PF * mailbox. If so, log a warning message and ignore this event. */ static bool ice_is_malicious_vf(struct ice_vf *vf, struct ice_mbx_data *mbxdata) { … } /** * ice_vc_process_vf_msg - Process request from VF * @pf: pointer to the PF structure * @event: pointer to the AQ event * @mbxdata: information used to detect VF attempting mailbox overflow * * called from the common asq/arq handler to * process request from VF */ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event, struct ice_mbx_data *mbxdata) { … }