// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2013 - 2018 Intel Corporation. */ #include "i40e.h" #include "i40e_lan_hmc.h" #include "i40e_virtchnl_pf.h" /*********************notification routines***********************/ /** * i40e_vc_vf_broadcast * @pf: pointer to the PF structure * @v_opcode: operation code * @v_retval: return value * @msg: pointer to the msg buffer * @msglen: msg length * * send a message to all VFs on a given PF **/ static void i40e_vc_vf_broadcast(struct i40e_pf *pf, enum virtchnl_ops v_opcode, int v_retval, u8 *msg, u16 msglen) { … } /** * i40e_vc_link_speed2mbps * converts i40e_aq_link_speed to integer value of Mbps * @link_speed: the speed to convert * * return the speed as direct value of Mbps. **/ static u32 i40e_vc_link_speed2mbps(enum i40e_aq_link_speed link_speed) { … } /** * i40e_set_vf_link_state * @vf: pointer to the VF structure * @pfe: pointer to PF event structure * @ls: pointer to link status structure * * set a link state on a single vf **/ static void i40e_set_vf_link_state(struct i40e_vf *vf, struct virtchnl_pf_event *pfe, struct i40e_link_status *ls) { … } /** * i40e_vc_notify_vf_link_state * @vf: pointer to the VF structure * * send a link status message to a single VF **/ static void i40e_vc_notify_vf_link_state(struct i40e_vf *vf) { … } /** * i40e_vc_notify_link_state * @pf: pointer to the PF structure * * send a link status message to all VFs on a given PF **/ void i40e_vc_notify_link_state(struct i40e_pf *pf) { … } /** * i40e_vc_notify_reset * @pf: pointer to the PF structure * * indicate a pending reset to all VFs on a given PF **/ void i40e_vc_notify_reset(struct i40e_pf *pf) { … } #ifdef CONFIG_PCI_IOV void i40e_restore_all_vfs_msi_state(struct pci_dev *pdev) { … } #endif /* CONFIG_PCI_IOV */ /** * i40e_vc_notify_vf_reset * @vf: pointer to the VF structure * * indicate a pending reset to the given VF **/ void i40e_vc_notify_vf_reset(struct i40e_vf *vf) { … } /***********************misc routines*****************************/ /** * i40e_vc_reset_vf * @vf: pointer to the VF info * @notify_vf: notify vf about reset or not * Reset VF handler. **/ static void i40e_vc_reset_vf(struct i40e_vf *vf, bool notify_vf) { … } /** * i40e_vc_isvalid_vsi_id * @vf: pointer to the VF info * @vsi_id: VF relative VSI id * * check for the valid VSI id **/ static inline bool i40e_vc_isvalid_vsi_id(struct i40e_vf *vf, u16 vsi_id) { … } /** * i40e_vc_isvalid_queue_id * @vf: pointer to the VF info * @vsi_id: vsi id * @qid: vsi relative queue id * * check for the valid queue id **/ static inline bool i40e_vc_isvalid_queue_id(struct i40e_vf *vf, u16 vsi_id, u16 qid) { … } /** * i40e_vc_isvalid_vector_id * @vf: pointer to the VF info * @vector_id: VF relative vector id * * check for the valid vector id **/ static inline bool i40e_vc_isvalid_vector_id(struct i40e_vf *vf, u32 vector_id) { … } /***********************vf resource mgmt routines*****************/ /** * i40e_vc_get_pf_queue_id * @vf: pointer to the VF info * @vsi_id: id of VSI as provided by the FW * @vsi_queue_id: vsi relative queue id * * return PF relative queue id **/ static u16 i40e_vc_get_pf_queue_id(struct i40e_vf *vf, u16 vsi_id, u8 vsi_queue_id) { … } /** * i40e_get_real_pf_qid * @vf: pointer to the VF info * @vsi_id: vsi id * @queue_id: queue number * * wrapper function to get pf_queue_id handling ADq code as well **/ static u16 i40e_get_real_pf_qid(struct i40e_vf *vf, u16 vsi_id, u16 queue_id) { … } /** * i40e_config_irq_link_list * @vf: pointer to the VF info * @vsi_id: id of VSI as given by the FW * @vecmap: irq map info * * configure irq link list from the map **/ static void i40e_config_irq_link_list(struct i40e_vf *vf, u16 vsi_id, struct virtchnl_vector_map *vecmap) { … } /** * i40e_release_rdma_qvlist * @vf: pointer to the VF. * **/ static void i40e_release_rdma_qvlist(struct i40e_vf *vf) { … } /** * i40e_config_rdma_qvlist * @vf: pointer to the VF info * @qvlist_info: queue and vector list * * Return 0 on success or < 0 on error **/ static int i40e_config_rdma_qvlist(struct i40e_vf *vf, struct virtchnl_rdma_qvlist_info *qvlist_info) { … } /** * i40e_config_vsi_tx_queue * @vf: pointer to the VF info * @vsi_id: id of VSI as provided by the FW * @vsi_queue_id: vsi relative queue index * @info: config. info * * configure tx queue **/ static int i40e_config_vsi_tx_queue(struct i40e_vf *vf, u16 vsi_id, u16 vsi_queue_id, struct virtchnl_txq_info *info) { … } /** * i40e_config_vsi_rx_queue * @vf: pointer to the VF info * @vsi_id: id of VSI as provided by the FW * @vsi_queue_id: vsi relative queue index * @info: config. info * * configure rx queue **/ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id, u16 vsi_queue_id, struct virtchnl_rxq_info *info) { … } /** * i40e_alloc_vsi_res * @vf: pointer to the VF info * @idx: VSI index, applies only for ADq mode, zero otherwise * * alloc VF vsi context & resources **/ static int i40e_alloc_vsi_res(struct i40e_vf *vf, u8 idx) { … } /** * i40e_map_pf_queues_to_vsi * @vf: pointer to the VF info * * PF maps LQPs to a VF by programming VSILAN_QTABLE & VPLAN_QTABLE. This * function takes care of first part VSILAN_QTABLE, mapping pf queues to VSI. **/ static void i40e_map_pf_queues_to_vsi(struct i40e_vf *vf) { … } /** * i40e_map_pf_to_vf_queues * @vf: pointer to the VF info * * PF maps LQPs to a VF by programming VSILAN_QTABLE & VPLAN_QTABLE. This * function takes care of the second part VPLAN_QTABLE & completes VF mappings. **/ static void i40e_map_pf_to_vf_queues(struct i40e_vf *vf) { … } /** * i40e_enable_vf_mappings * @vf: pointer to the VF info * * enable VF mappings **/ static void i40e_enable_vf_mappings(struct i40e_vf *vf) { … } /** * i40e_disable_vf_mappings * @vf: pointer to the VF info * * disable VF mappings **/ static void i40e_disable_vf_mappings(struct i40e_vf *vf) { … } /** * i40e_free_vf_res * @vf: pointer to the VF info * * free VF resources **/ static void i40e_free_vf_res(struct i40e_vf *vf) { … } /** * i40e_alloc_vf_res * @vf: pointer to the VF info * * allocate VF resources **/ static int i40e_alloc_vf_res(struct i40e_vf *vf) { … } #define VF_DEVICE_STATUS … #define VF_TRANS_PENDING_MASK … /** * i40e_quiesce_vf_pci * @vf: pointer to the VF structure * * Wait for VF PCI transactions to be cleared after reset. Returns -EIO * if the transactions never clear. **/ static int i40e_quiesce_vf_pci(struct i40e_vf *vf) { … } /** * __i40e_getnum_vf_vsi_vlan_filters * @vsi: pointer to the vsi * * called to get the number of VLANs offloaded on this VF **/ static int __i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi) { … } /** * i40e_getnum_vf_vsi_vlan_filters * @vsi: pointer to the vsi * * wrapper for __i40e_getnum_vf_vsi_vlan_filters() with spinlock held **/ static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi) { … } /** * i40e_get_vlan_list_sync * @vsi: pointer to the VSI * @num_vlans: number of VLANs in mac_filter_hash, returned to caller * @vlan_list: list of VLANs present in mac_filter_hash, returned to caller. * This array is allocated here, but has to be freed in caller. * * Called to get number of VLANs and VLAN list present in mac_filter_hash. **/ static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, u16 *num_vlans, s16 **vlan_list) { … } /** * i40e_set_vsi_promisc * @vf: pointer to the VF struct * @seid: VSI number * @multi_enable: set MAC L2 layer multicast promiscuous enable/disable * for a given VLAN * @unicast_enable: set MAC L2 layer unicast promiscuous enable/disable * for a given VLAN * @vl: List of VLANs - apply filter for given VLANs * @num_vlans: Number of elements in @vl **/ static int i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable, bool unicast_enable, s16 *vl, u16 num_vlans) { … } /** * i40e_config_vf_promiscuous_mode * @vf: pointer to the VF info * @vsi_id: VSI id * @allmulti: set MAC L2 layer multicast promiscuous enable/disable * @alluni: set MAC L2 layer unicast promiscuous enable/disable * * Called from the VF to configure the promiscuous mode of * VF vsis and from the VF reset path to reset promiscuous mode. **/ static int i40e_config_vf_promiscuous_mode(struct i40e_vf *vf, u16 vsi_id, bool allmulti, bool alluni) { … } /** * i40e_sync_vfr_reset * @hw: pointer to hw struct * @vf_id: VF identifier * * Before trigger hardware reset, we need to know if no other process has * reserved the hardware for any reset operations. This check is done by * examining the status of the RSTAT1 register used to signal the reset. **/ static int i40e_sync_vfr_reset(struct i40e_hw *hw, int vf_id) { … } /** * i40e_trigger_vf_reset * @vf: pointer to the VF structure * @flr: VFLR was issued or not * * Trigger hardware to start a reset for a particular VF. Expects the caller * to wait the proper amount of time to allow hardware to reset the VF before * it cleans up and restores VF functionality. **/ static void i40e_trigger_vf_reset(struct i40e_vf *vf, bool flr) { … } /** * i40e_cleanup_reset_vf * @vf: pointer to the VF structure * * Cleanup a VF after the hardware reset is finished. Expects the caller to * have verified whether the reset is finished properly, and ensure the * minimum amount of wait time has passed. **/ static void i40e_cleanup_reset_vf(struct i40e_vf *vf) { … } /** * i40e_reset_vf * @vf: pointer to the VF structure * @flr: VFLR was issued or not * * Returns true if the VF is in reset, resets successfully, or resets * are disabled and false otherwise. **/ bool i40e_reset_vf(struct i40e_vf *vf, bool flr) { … } /** * i40e_reset_all_vfs * @pf: pointer to the PF structure * @flr: VFLR was issued or not * * Reset all allocated VFs in one go. First, tell the hardware to reset each * VF, then do all the waiting in one chunk, and finally finish restoring each * VF after the wait. This is useful during PF routines which need to reset * all VFs, as otherwise it must perform these resets in a serialized fashion. * * Returns true if any VFs were reset, and false otherwise. **/ bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr) { … } /** * i40e_free_vfs * @pf: pointer to the PF structure * * free VF resources **/ void i40e_free_vfs(struct i40e_pf *pf) { … } #ifdef CONFIG_PCI_IOV /** * i40e_alloc_vfs * @pf: pointer to the PF structure * @num_alloc_vfs: number of VFs to allocate * * allocate VF resources **/ int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs) { … } #endif /** * i40e_pci_sriov_enable * @pdev: pointer to a pci_dev structure * @num_vfs: number of VFs to allocate * * Enable or change the number of VFs **/ static int i40e_pci_sriov_enable(struct pci_dev *pdev, int num_vfs) { … } /** * i40e_pci_sriov_configure * @pdev: pointer to a pci_dev structure * @num_vfs: number of VFs to allocate * * Enable or change the number of VFs. Called when the user updates the number * of VFs in sysfs. **/ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs) { … } /***********************virtual channel routines******************/ /** * i40e_vc_send_msg_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 **/ static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode, u32 v_retval, u8 *msg, u16 msglen) { … } /** * i40e_vc_send_resp_to_vf * @vf: pointer to the VF info * @opcode: operation code * @retval: return value * * send resp msg to VF **/ static int i40e_vc_send_resp_to_vf(struct i40e_vf *vf, enum virtchnl_ops opcode, int retval) { … } /** * i40e_sync_vf_state * @vf: pointer to the VF info * @state: VF state * * Called from a VF message to synchronize the service with a potential * VF reset state **/ static bool i40e_sync_vf_state(struct i40e_vf *vf, enum i40e_vf_states state) { … } /** * i40e_vc_get_version_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 i40e_vc_get_version_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_del_qch - delete all the additional VSIs created as a part of ADq * @vf: pointer to VF structure **/ static void i40e_del_qch(struct i40e_vf *vf) { … } /** * i40e_vc_get_max_frame_size * @vf: pointer to the VF * * 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 i40e_vc_get_max_frame_size(struct i40e_vf *vf) { … } /** * i40e_vc_get_vf_resources_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * called from the VF to request its resources **/ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_config_promiscuous_mode_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * called from the VF to configure the promiscuous mode of * VF vsis **/ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_config_queues_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 i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_validate_queue_map - check queue map is valid * @vf: the VF structure pointer * @vsi_id: vsi id * @queuemap: Tx or Rx queue map * * check if Tx or Rx queue map is valid **/ static int i40e_validate_queue_map(struct i40e_vf *vf, u16 vsi_id, unsigned long queuemap) { … } /** * i40e_vc_config_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 i40e_vc_config_irq_map_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_ctrl_vf_tx_rings * @vsi: the SRIOV VSI being configured * @q_map: bit map of the queues to be enabled * @enable: start or stop the queue **/ static int i40e_ctrl_vf_tx_rings(struct i40e_vsi *vsi, unsigned long q_map, bool enable) { … } /** * i40e_ctrl_vf_rx_rings * @vsi: the SRIOV VSI being configured * @q_map: bit map of the queues to be enabled * @enable: start or stop the queue **/ static int i40e_ctrl_vf_rx_rings(struct i40e_vsi *vsi, unsigned long q_map, bool enable) { … } /** * i40e_vc_validate_vqs_bitmaps - validate Rx/Tx queue bitmaps from VIRTHCHNL * @vqs: virtchnl_queue_select structure containing bitmaps to validate * * Returns true if validation was successful, else false. */ static bool i40e_vc_validate_vqs_bitmaps(struct virtchnl_queue_select *vqs) { … } /** * i40e_vc_enable_queues_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 i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_disable_queues_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 i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_check_enough_queue - find big enough queue number * @vf: pointer to the VF info * @needed: the number of items needed * * Returns the base item index of the queue, or negative for error **/ static int i40e_check_enough_queue(struct i40e_vf *vf, u16 needed) { … } /** * i40e_vc_request_queues_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 queues and return result of sending VF a message. **/ static int i40e_vc_request_queues_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_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 i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_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 i40e_can_vf_change_mac(struct i40e_vf *vf) { … } #define I40E_MAX_MACVLAN_PER_HW … #define I40E_MAX_MACVLAN_PER_PF(num_ports) … /* If the VF is not trusted restrict the number of MAC/VLAN it can program * MAC filters: 16 for multicast, 1 for MAC, 1 for broadcast */ #define I40E_VC_MAX_MAC_ADDR_PER_VF … #define I40E_VC_MAX_VLAN_PER_VF … #define I40E_VC_MAX_MACVLAN_PER_TRUSTED_VF(vf_num, num_ports) … /** * i40e_check_vf_permission * @vf: pointer to the VF info * @al: MAC address list from virtchnl * * Check that the given list of MAC addresses is allowed. Will return -EPERM * if any address in the list is not valid. Checks the following conditions: * * 1) broadcast and zero addresses are never valid * 2) unicast addresses are not allowed if the VMM has administratively set * the VF MAC address, unless the VF is marked as privileged. * 3) There is enough space to add all the addresses. * * Note that to guarantee consistency, it is expected this function be called * while holding the mac_filter_hash_lock, as otherwise the current number of * addresses might not be accurate. **/ static inline int i40e_check_vf_permission(struct i40e_vf *vf, struct virtchnl_ether_addr_list *al) { … } /** * i40e_vc_ether_addr_type - get type of virtchnl_ether_addr * @vc_ether_addr: used to extract the type **/ static u8 i40e_vc_ether_addr_type(struct virtchnl_ether_addr *vc_ether_addr) { … } /** * i40e_is_vc_addr_legacy * @vc_ether_addr: VIRTCHNL structure that contains MAC and type * * check if the MAC address is from an older VF **/ static bool i40e_is_vc_addr_legacy(struct virtchnl_ether_addr *vc_ether_addr) { … } /** * i40e_is_vc_addr_primary * @vc_ether_addr: VIRTCHNL structure that contains MAC and type * * check if the MAC address is the VF's primary MAC * This function should only be called when the MAC address in * virtchnl_ether_addr is a valid unicast MAC **/ static bool i40e_is_vc_addr_primary(struct virtchnl_ether_addr *vc_ether_addr) { … } /** * i40e_update_vf_mac_addr * @vf: VF to update * @vc_ether_addr: structure from VIRTCHNL with MAC to add * * update the VF's cached hardware MAC if allowed **/ static void i40e_update_vf_mac_addr(struct i40e_vf *vf, struct virtchnl_ether_addr *vc_ether_addr) { … } /** * i40e_vc_add_mac_addr_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * add guest mac address filter **/ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_del_mac_addr_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * remove guest mac address filter **/ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_add_vlan_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * program guest vlan id **/ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_remove_vlan_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * remove programmed guest vlan id **/ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_rdma_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * @msglen: msg length * * called from the VF for the iwarp msgs **/ static int i40e_vc_rdma_msg(struct i40e_vf *vf, u8 *msg, u16 msglen) { … } /** * i40e_vc_rdma_qvmap_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer * @config: config qvmap or release it * * called from the VF for the iwarp msgs **/ static int i40e_vc_rdma_qvmap_msg(struct i40e_vf *vf, u8 *msg, bool config) { … } /** * i40e_vc_config_rss_key * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * Configure the VF's RSS key **/ static int i40e_vc_config_rss_key(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_config_rss_lut * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * Configure the VF's RSS LUT **/ static int i40e_vc_config_rss_lut(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_get_rss_hena * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * Return the RSS HENA bits allowed by the hardware **/ static int i40e_vc_get_rss_hena(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_set_rss_hena * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * Set the RSS HENA bits for the VF **/ static int i40e_vc_set_rss_hena(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_enable_vlan_stripping * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * Enable vlan header stripping for the VF **/ static int i40e_vc_enable_vlan_stripping(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_disable_vlan_stripping * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * Disable vlan header stripping for the VF **/ static int i40e_vc_disable_vlan_stripping(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_validate_cloud_filter * @vf: pointer to VF structure * @tc_filter: pointer to filter requested * * This function validates cloud filter programmed as TC filter for ADq **/ static int i40e_validate_cloud_filter(struct i40e_vf *vf, struct virtchnl_filter *tc_filter) { … } /** * i40e_find_vsi_from_seid - searches for the vsi with the given seid * @vf: pointer to the VF info * @seid: seid of the vsi it is searching for **/ static struct i40e_vsi *i40e_find_vsi_from_seid(struct i40e_vf *vf, u16 seid) { … } /** * i40e_del_all_cloud_filters * @vf: pointer to the VF info * * This function deletes all cloud filters **/ static void i40e_del_all_cloud_filters(struct i40e_vf *vf) { … } /** * i40e_vc_del_cloud_filter * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * This function deletes a cloud filter programmed as TC filter for ADq **/ static int i40e_vc_del_cloud_filter(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_add_cloud_filter * @vf: pointer to the VF info * @msg: pointer to the msg buffer * * This function adds a cloud filter programmed as TC filter for ADq **/ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_add_qch_msg: Add queue channel and enable ADq * @vf: pointer to the VF info * @msg: pointer to the msg buffer **/ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_del_qch_msg * @vf: pointer to the VF info * @msg: pointer to the msg buffer **/ static int i40e_vc_del_qch_msg(struct i40e_vf *vf, u8 *msg) { … } /** * i40e_vc_process_vf_msg * @pf: pointer to the PF structure * @vf_id: source VF id * @v_opcode: operation code * @v_retval: unused return value code * @msg: pointer to the msg buffer * @msglen: msg length * * called from the common aeq/arq handler to * process request from VF **/ int i40e_vc_process_vf_msg(struct i40e_pf *pf, s16 vf_id, u32 v_opcode, u32 __always_unused v_retval, u8 *msg, u16 msglen) { … } /** * i40e_vc_process_vflr_event * @pf: pointer to the PF structure * * called from the vlfr irq handler to * free up VF resources and state variables **/ int i40e_vc_process_vflr_event(struct i40e_pf *pf) { … } /** * i40e_validate_vf * @pf: the physical function * @vf_id: VF identifier * * Check that the VF is enabled and the VSI exists. * * Returns 0 on success, negative on failure **/ static int i40e_validate_vf(struct i40e_pf *pf, int vf_id) { … } /** * i40e_check_vf_init_timeout * @vf: the virtual function * * Check that the VF's initialization was successfully done and if not * wait up to 300ms for its finish. * * Returns true when VF is initialized, false on timeout **/ static bool i40e_check_vf_init_timeout(struct i40e_vf *vf) { … } /** * i40e_ndo_set_vf_mac * @netdev: network interface device structure * @vf_id: VF identifier * @mac: mac address * * program VF mac address **/ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac) { … } /** * i40e_ndo_set_vf_port_vlan * @netdev: network interface device structure * @vf_id: VF identifier * @vlan_id: mac address * @qos: priority setting * @vlan_proto: vlan protocol * * program VF vlan id and/or qos **/ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos, __be16 vlan_proto) { … } /** * i40e_ndo_set_vf_bw * @netdev: network interface device structure * @vf_id: VF identifier * @min_tx_rate: Minimum Tx rate * @max_tx_rate: Maximum Tx rate * * configure VF Tx rate **/ int i40e_ndo_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate, int max_tx_rate) { … } /** * i40e_ndo_get_vf_config * @netdev: network interface device structure * @vf_id: VF identifier * @ivi: VF configuration structure * * return VF configuration **/ int i40e_ndo_get_vf_config(struct net_device *netdev, int vf_id, struct ifla_vf_info *ivi) { … } /** * i40e_ndo_set_vf_link_state * @netdev: network interface device structure * @vf_id: VF identifier * @link: required link state * * Set the link state of a specified VF, regardless of physical link state **/ int i40e_ndo_set_vf_link_state(struct net_device *netdev, int vf_id, int link) { … } /** * i40e_ndo_set_vf_spoofchk * @netdev: network interface device structure * @vf_id: VF identifier * @enable: flag to enable or disable feature * * Enable or disable VF spoof checking **/ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable) { … } /** * i40e_ndo_set_vf_trust * @netdev: network interface device structure of the pf * @vf_id: VF identifier * @setting: trust setting * * Enable or disable VF trust setting **/ int i40e_ndo_set_vf_trust(struct net_device *netdev, int vf_id, bool setting) { … } /** * i40e_get_vf_stats - populate some stats for the VF * @netdev: the netdev of the PF * @vf_id: the host OS identifier (0-127) * @vf_stats: pointer to the OS memory to be initialized */ int i40e_get_vf_stats(struct net_device *netdev, int vf_id, struct ifla_vf_stats *vf_stats) { … }