// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2013 - 2018 Intel Corporation. */ #include <linux/net/intel/libie/rx.h> #include "iavf.h" #include "iavf_prototype.h" /** * iavf_send_pf_msg * @adapter: adapter structure * @op: virtual channel opcode * @msg: pointer to message buffer * @len: message length * * Send message to PF and print status if failure. **/ static int iavf_send_pf_msg(struct iavf_adapter *adapter, enum virtchnl_ops op, u8 *msg, u16 len) { … } /** * iavf_send_api_ver * @adapter: adapter structure * * Send API version admin queue message to the PF. The reply is not checked * in this function. Returns 0 if the message was successfully * sent, or one of the IAVF_ADMIN_QUEUE_ERROR_ statuses if not. **/ int iavf_send_api_ver(struct iavf_adapter *adapter) { … } /** * iavf_poll_virtchnl_msg * @hw: HW configuration structure * @event: event to populate on success * @op_to_poll: requested virtchnl op to poll for * * Initialize poll for virtchnl msg matching the requested_op. Returns 0 * if a message of the correct opcode is in the queue or an error code * if no message matching the op code is waiting and other failures. */ static int iavf_poll_virtchnl_msg(struct iavf_hw *hw, struct iavf_arq_event_info *event, enum virtchnl_ops op_to_poll) { … } /** * iavf_verify_api_ver * @adapter: adapter structure * * Compare API versions with the PF. Must be called after admin queue is * initialized. Returns 0 if API versions match, -EIO if they do not, * IAVF_ERR_ADMIN_QUEUE_NO_WORK if the admin queue is empty, and any errors * from the firmware are propagated. **/ int iavf_verify_api_ver(struct iavf_adapter *adapter) { … } /** * iavf_send_vf_config_msg * @adapter: adapter structure * * Send VF configuration request admin queue message to the PF. The reply * is not checked in this function. Returns 0 if the message was * successfully sent, or one of the IAVF_ADMIN_QUEUE_ERROR_ statuses if not. **/ int iavf_send_vf_config_msg(struct iavf_adapter *adapter) { … } int iavf_send_vf_offload_vlan_v2_msg(struct iavf_adapter *adapter) { … } /** * iavf_validate_num_queues * @adapter: adapter structure * * Validate that the number of queues the PF has sent in * VIRTCHNL_OP_GET_VF_RESOURCES is not larger than the VF can handle. **/ static void iavf_validate_num_queues(struct iavf_adapter *adapter) { … } /** * iavf_get_vf_config * @adapter: private adapter structure * * Get VF configuration from PF and populate hw structure. Must be called after * admin queue is initialized. Busy waits until response is received from PF, * with maximum timeout. Response from PF is returned in the buffer for further * processing by the caller. **/ int iavf_get_vf_config(struct iavf_adapter *adapter) { … } int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter) { … } /** * iavf_configure_queues * @adapter: adapter structure * * Request that the PF set up our (previously allocated) queues. **/ void iavf_configure_queues(struct iavf_adapter *adapter) { … } /** * iavf_enable_queues * @adapter: adapter structure * * Request that the PF enable all of our queues. **/ void iavf_enable_queues(struct iavf_adapter *adapter) { … } /** * iavf_disable_queues * @adapter: adapter structure * * Request that the PF disable all of our queues. **/ void iavf_disable_queues(struct iavf_adapter *adapter) { … } /** * iavf_map_queues * @adapter: adapter structure * * Request that the PF map queues to interrupt vectors. Misc causes, including * admin queue, are always mapped to vector 0. **/ void iavf_map_queues(struct iavf_adapter *adapter) { … } /** * iavf_set_mac_addr_type - Set the correct request type from the filter type * @virtchnl_ether_addr: pointer to requested list element * @filter: pointer to requested filter **/ static void iavf_set_mac_addr_type(struct virtchnl_ether_addr *virtchnl_ether_addr, const struct iavf_mac_filter *filter) { … } /** * iavf_add_ether_addrs * @adapter: adapter structure * * Request that the PF add one or more addresses to our filters. **/ void iavf_add_ether_addrs(struct iavf_adapter *adapter) { … } /** * iavf_del_ether_addrs * @adapter: adapter structure * * Request that the PF remove one or more addresses from our filters. **/ void iavf_del_ether_addrs(struct iavf_adapter *adapter) { … } /** * iavf_mac_add_ok * @adapter: adapter structure * * Submit list of filters based on PF response. **/ static void iavf_mac_add_ok(struct iavf_adapter *adapter) { … } /** * iavf_mac_add_reject * @adapter: adapter structure * * Remove filters from list based on PF response. **/ static void iavf_mac_add_reject(struct iavf_adapter *adapter) { … } /** * iavf_vlan_add_reject * @adapter: adapter structure * * Remove VLAN filters from list based on PF response. **/ static void iavf_vlan_add_reject(struct iavf_adapter *adapter) { … } /** * iavf_add_vlans * @adapter: adapter structure * * Request that the PF add one or more VLAN filters to our VSI. **/ void iavf_add_vlans(struct iavf_adapter *adapter) { … } /** * iavf_del_vlans * @adapter: adapter structure * * Request that the PF remove one or more VLAN filters from our VSI. **/ void iavf_del_vlans(struct iavf_adapter *adapter) { … } /** * iavf_set_promiscuous * @adapter: adapter structure * * Request that the PF enable promiscuous mode for our VSI. **/ void iavf_set_promiscuous(struct iavf_adapter *adapter) { … } /** * iavf_request_stats * @adapter: adapter structure * * Request VSI statistics from PF. **/ void iavf_request_stats(struct iavf_adapter *adapter) { … } /** * iavf_get_hena * @adapter: adapter structure * * Request hash enable capabilities from PF **/ void iavf_get_hena(struct iavf_adapter *adapter) { … } /** * iavf_set_hena * @adapter: adapter structure * * Request the PF to set our RSS hash capabilities **/ void iavf_set_hena(struct iavf_adapter *adapter) { … } /** * iavf_set_rss_key * @adapter: adapter structure * * Request the PF to set our RSS hash key **/ void iavf_set_rss_key(struct iavf_adapter *adapter) { … } /** * iavf_set_rss_lut * @adapter: adapter structure * * Request the PF to set our RSS lookup table **/ void iavf_set_rss_lut(struct iavf_adapter *adapter) { … } /** * iavf_set_rss_hfunc * @adapter: adapter structure * * Request the PF to set our RSS Hash function **/ void iavf_set_rss_hfunc(struct iavf_adapter *adapter) { … } /** * iavf_enable_vlan_stripping * @adapter: adapter structure * * Request VLAN header stripping to be enabled **/ void iavf_enable_vlan_stripping(struct iavf_adapter *adapter) { … } /** * iavf_disable_vlan_stripping * @adapter: adapter structure * * Request VLAN header stripping to be disabled **/ void iavf_disable_vlan_stripping(struct iavf_adapter *adapter) { … } /** * iavf_tpid_to_vc_ethertype - transform from VLAN TPID to virtchnl ethertype * @tpid: VLAN TPID (i.e. 0x8100, 0x88a8, etc.) */ static u32 iavf_tpid_to_vc_ethertype(u16 tpid) { … } /** * iavf_set_vc_offload_ethertype - set virtchnl ethertype for offload message * @adapter: adapter structure * @msg: message structure used for updating offloads over virtchnl to update * @tpid: VLAN TPID (i.e. 0x8100, 0x88a8, etc.) * @offload_op: opcode used to determine which support structure to check */ static int iavf_set_vc_offload_ethertype(struct iavf_adapter *adapter, struct virtchnl_vlan_setting *msg, u16 tpid, enum virtchnl_ops offload_op) { … } /** * iavf_clear_offload_v2_aq_required - clear AQ required bit for offload request * @adapter: adapter structure * @tpid: VLAN TPID * @offload_op: opcode used to determine which AQ required bit to clear */ static void iavf_clear_offload_v2_aq_required(struct iavf_adapter *adapter, u16 tpid, enum virtchnl_ops offload_op) { … } /** * iavf_send_vlan_offload_v2 - send offload enable/disable over virtchnl * @adapter: adapter structure * @tpid: VLAN TPID used for the command (i.e. 0x8100 or 0x88a8) * @offload_op: offload_op used to make the request over virtchnl */ static void iavf_send_vlan_offload_v2(struct iavf_adapter *adapter, u16 tpid, enum virtchnl_ops offload_op) { … } /** * iavf_enable_vlan_stripping_v2 - enable VLAN stripping * @adapter: adapter structure * @tpid: VLAN TPID used to enable VLAN stripping */ void iavf_enable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid) { … } /** * iavf_disable_vlan_stripping_v2 - disable VLAN stripping * @adapter: adapter structure * @tpid: VLAN TPID used to disable VLAN stripping */ void iavf_disable_vlan_stripping_v2(struct iavf_adapter *adapter, u16 tpid) { … } /** * iavf_enable_vlan_insertion_v2 - enable VLAN insertion * @adapter: adapter structure * @tpid: VLAN TPID used to enable VLAN insertion */ void iavf_enable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid) { … } /** * iavf_disable_vlan_insertion_v2 - disable VLAN insertion * @adapter: adapter structure * @tpid: VLAN TPID used to disable VLAN insertion */ void iavf_disable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid) { … } /** * iavf_print_link_message - print link up or down * @adapter: adapter structure * * Log a message telling the world of our wonderous link status */ static void iavf_print_link_message(struct iavf_adapter *adapter) { … } /** * iavf_get_vpe_link_status * @adapter: adapter structure * @vpe: virtchnl_pf_event structure * * Helper function for determining the link status **/ static bool iavf_get_vpe_link_status(struct iavf_adapter *adapter, struct virtchnl_pf_event *vpe) { … } /** * iavf_set_adapter_link_speed_from_vpe * @adapter: adapter structure for which we are setting the link speed * @vpe: virtchnl_pf_event structure that contains the link speed we are setting * * Helper function for setting iavf_adapter link speed **/ static void iavf_set_adapter_link_speed_from_vpe(struct iavf_adapter *adapter, struct virtchnl_pf_event *vpe) { … } /** * iavf_enable_channels * @adapter: adapter structure * * Request that the PF enable channels as specified by * the user via tc tool. **/ void iavf_enable_channels(struct iavf_adapter *adapter) { … } /** * iavf_disable_channels * @adapter: adapter structure * * Request that the PF disable channels that are configured **/ void iavf_disable_channels(struct iavf_adapter *adapter) { … } /** * iavf_print_cloud_filter * @adapter: adapter structure * @f: cloud filter to print * * Print the cloud filter **/ static void iavf_print_cloud_filter(struct iavf_adapter *adapter, struct virtchnl_filter *f) { … } /** * iavf_add_cloud_filter * @adapter: adapter structure * * Request that the PF add cloud filters as specified * by the user via tc tool. **/ void iavf_add_cloud_filter(struct iavf_adapter *adapter) { … } /** * iavf_del_cloud_filter * @adapter: adapter structure * * Request that the PF delete cloud filters as specified * by the user via tc tool. **/ void iavf_del_cloud_filter(struct iavf_adapter *adapter) { … } /** * iavf_add_fdir_filter * @adapter: the VF adapter structure * * Request that the PF add Flow Director filters as specified * by the user via ethtool. **/ void iavf_add_fdir_filter(struct iavf_adapter *adapter) { … } /** * iavf_del_fdir_filter * @adapter: the VF adapter structure * * Request that the PF delete Flow Director filters as specified * by the user via ethtool. **/ void iavf_del_fdir_filter(struct iavf_adapter *adapter) { … } /** * iavf_add_adv_rss_cfg * @adapter: the VF adapter structure * * Request that the PF add RSS configuration as specified * by the user via ethtool. **/ void iavf_add_adv_rss_cfg(struct iavf_adapter *adapter) { … } /** * iavf_del_adv_rss_cfg * @adapter: the VF adapter structure * * Request that the PF delete RSS configuration as specified * by the user via ethtool. **/ void iavf_del_adv_rss_cfg(struct iavf_adapter *adapter) { … } /** * iavf_request_reset * @adapter: adapter structure * * Request that the PF reset this VF. No response is expected. **/ int iavf_request_reset(struct iavf_adapter *adapter) { … } /** * iavf_netdev_features_vlan_strip_set - update vlan strip status * @netdev: ptr to netdev being adjusted * @enable: enable or disable vlan strip * * Helper function to change vlan strip status in netdev->features. */ static void iavf_netdev_features_vlan_strip_set(struct net_device *netdev, const bool enable) { … } /** * iavf_activate_fdir_filters - Reactivate all FDIR filters after a reset * @adapter: private adapter structure * * Called after a reset to re-add all FDIR filters and delete some of them * if they were pending to be deleted. */ static void iavf_activate_fdir_filters(struct iavf_adapter *adapter) { … } /** * iavf_virtchnl_completion * @adapter: adapter structure * @v_opcode: opcode sent by PF * @v_retval: retval sent by PF * @msg: message sent by PF * @msglen: message length * * Asynchronous completion function for admin queue messages. Rather than busy * wait, we fire off our requests and assume that no errors will be returned. * This function handles the reply messages. **/ void iavf_virtchnl_completion(struct iavf_adapter *adapter, enum virtchnl_ops v_opcode, enum iavf_status v_retval, u8 *msg, u16 msglen) { … }