Lines Matching defs:pf

476  * @pf: the PF struct
478 static void i40e_partition_setting_complaint(struct i40e_pf *pf)
480 dev_info(&pf->pdev->dev,
486 * @pf: PF struct with phy_types
490 static void i40e_phy_type_to_ethtool(struct i40e_pf *pf,
493 struct i40e_link_status *hw_link_info = &pf->hw.phy.link_info;
494 u64 phy_types = pf->hw.phy.phy_types;
505 if (test_bit(I40E_HW_CAP_100M_SGMII, pf->hw.caps)) {
604 !test_bit(I40E_HW_CAP_CRT_RETIMER, pf->hw.caps)) {
612 !test_bit(I40E_HW_CAP_CRT_RETIMER, pf->hw.caps)) {
767 * @pf: pointer to physical function struct
772 struct i40e_pf *pf)
920 if (test_bit(I40E_HW_CAP_100M_SGMII, pf->hw.caps)) {
1000 i40e_phy_type_to_ethtool(pf, &cap_ksettings);
1040 * @pf: pointer to physical function struct
1046 struct i40e_pf *pf)
1051 i40e_phy_type_to_ethtool(pf, ks);
1069 struct i40e_pf *pf = np->vsi->back;
1070 struct i40e_hw *hw = &pf->hw;
1078 i40e_get_settings_link_up(hw, ks, netdev, pf);
1080 i40e_get_settings_link_down(hw, ks, pf);
1226 struct i40e_pf *pf = np->vsi->back;
1229 struct i40e_hw *hw = &pf->hw;
1241 i40e_partition_setting_complaint(pf);
1297 while (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state)) {
1479 clear_bit(__I40E_CONFIG_BUSY, pf->state);
1488 struct i40e_pf *pf = np->vsi->back;
1489 struct i40e_hw *hw = &pf->hw;
1524 i40e_set_fec_in_flags(fec_cfg, pf->flags);
1546 struct i40e_pf *pf = np->vsi->back;
1547 struct i40e_hw *hw = &pf->hw;
1588 struct i40e_pf *pf = np->vsi->back;
1589 struct i40e_hw *hw = &pf->hw;
1620 dev_warn(&pf->pdev->dev, "Unsupported FEC mode: %d",
1632 struct i40e_pf *pf = np->vsi->back;
1633 struct i40e_hw *hw = &pf->hw;
1659 struct i40e_pf *pf = np->vsi->back;
1660 struct i40e_hw *hw = &pf->hw;
1694 struct i40e_pf *pf = np->vsi->back;
1696 struct i40e_hw *hw = &pf->hw;
1709 i40e_partition_setting_complaint(pf);
1723 if (!test_bit(__I40E_DOWN, pf->state) && !is_an) {
1774 if (!test_bit(__I40E_DOWN, pf->state) && is_an) {
1777 if (!test_bit(__I40E_DOWN, pf->state))
1787 struct i40e_pf *pf = np->vsi->back;
1788 u32 debug_mask = pf->hw.debug_mask;
1793 return pf->msg_enable;
1799 struct i40e_pf *pf = np->vsi->back;
1802 pf->hw.debug_mask = data;
1804 pf->msg_enable = data;
1822 struct i40e_pf *pf = np->vsi->back;
1823 struct i40e_hw *hw = &pf->hw;
1854 struct i40e_pf *pf = np->vsi->back;
1874 else if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) ||
1875 test_bit(__I40E_RESET_INTR_RECEIVED, pf->state))
1881 dev_info(&pf->pdev->dev,
1899 dev_info(&pf->pdev->dev,
1919 dev_info(&pf->pdev->dev,
1925 dev_info(&pf->pdev->dev,
1930 dev_info(&pf->pdev->dev,
1967 struct i40e_pf *pf = np->vsi->back;
1980 else if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) ||
1981 test_bit(__I40E_RESET_INTR_RECEIVED, pf->state))
1987 dev_info(&pf->pdev->dev,
2001 struct i40e_pf *pf = vsi->back;
2004 i40e_nvm_version_str(&pf->hw, drvinfo->fw_version,
2006 strscpy(drvinfo->bus_info, pci_name(pf->pdev),
2009 if (pf->hw.pf_id == 0)
2013 static u32 i40e_get_max_num_descriptors(struct i40e_pf *pf)
2015 struct i40e_hw *hw = &pf->hw;
2031 struct i40e_pf *pf = np->vsi->back;
2032 struct i40e_vsi *vsi = i40e_pf_get_main_vsi(pf);
2034 ring->rx_max_pending = i40e_get_max_num_descriptors(pf);
2035 ring->tx_max_pending = i40e_get_max_num_descriptors(pf);
2065 struct i40e_pf *pf = vsi->back;
2073 max_num_descriptors = i40e_get_max_num_descriptors(pf);
2100 while (test_and_set_bit(__I40E_CONFIG_BUSY, pf->state)) {
2269 clear_bit(__I40E_CONFIG_BUSY, pf->state);
2292 struct i40e_pf *pf = vsi->back;
2295 if (vsi->type == I40E_VSI_MAIN && pf->hw.partition_id == 1)
2323 struct i40e_pf *pf = vsi->back;
2332 (pf->hw.pf_id == 0 ? I40E_GL_PRIV_FLAGS_STR_LEN : 0);
2363 * @pf: the PF device structure
2366 * The PFC stats are found as arrays in pf->stats, which is not easy to pass
2371 i40e_get_pfc_stats(struct i40e_pf *pf, unsigned int i)
2374 .stat = pf->stats.stat[priority]
2405 struct i40e_pf *pf = vsi->back;
2425 if (vsi->type != I40E_VSI_MAIN || pf->hw.partition_id != 1)
2428 veb = i40e_pf_get_main_veb(pf);
2429 veb_stats = veb && test_bit(I40E_FLAG_VEB_STATS_ENA, pf->flags);
2453 i40e_add_ethtool_stats(&data, pf, i40e_gstrings_stats);
2456 struct i40e_pfc_stats pfc = i40e_get_pfc_stats(pf, i);
2480 struct i40e_pf *pf = vsi->back;
2495 if (vsi->type != I40E_VSI_MAIN || pf->hw.partition_id != 1)
2517 struct i40e_pf *pf = vsi->back;
2523 if (pf->hw.pf_id != 0)
2551 struct i40e_pf *pf = i40e_netdev_to_pf(dev);
2554 if (!test_bit(I40E_FLAG_PTP_ENA, pf->flags))
2564 if (pf->ptp_clock)
2565 info->phc_index = ptp_clock_index(pf->ptp_clock);
2576 if (test_bit(I40E_HW_CAP_PTP_L4, pf->hw.caps))
2592 struct i40e_pf *pf = np->vsi->back;
2596 netif_info(pf, hw, netdev, "link test\n");
2597 status = i40e_get_link_status(&pf->hw, &link_up);
2599 netif_err(pf, drv, netdev, "link query timed out, please retry test\n");
2615 struct i40e_pf *pf = np->vsi->back;
2617 netif_info(pf, hw, netdev, "register test\n");
2618 *data = i40e_diag_reg_test(&pf->hw);
2626 struct i40e_pf *pf = np->vsi->back;
2628 netif_info(pf, hw, netdev, "eeprom test\n");
2629 *data = i40e_diag_eeprom_test(&pf->hw);
2632 pf->hw.nvmupd_state = I40E_NVMUPD_STATE_INIT;
2640 struct i40e_pf *pf = np->vsi->back;
2641 u16 swc_old = pf->sw_int_count;
2643 netif_info(pf, hw, netdev, "interrupt test\n");
2644 wr32(&pf->hw, I40E_PFINT_DYN_CTL0,
2651 *data = (swc_old == pf->sw_int_count);
2656 static inline bool i40e_active_vfs(struct i40e_pf *pf)
2658 struct i40e_vf *vfs = pf->vf;
2661 for (i = 0; i < pf->num_alloc_vfs; i++)
2667 static inline bool i40e_active_vmdqs(struct i40e_pf *pf)
2669 return !!i40e_find_vsi_by_type(pf, I40E_VSI_VMDQ2);
2677 struct i40e_pf *pf = np->vsi->back;
2681 netif_info(pf, drv, netdev, "offline testing starting\n");
2683 set_bit(__I40E_TESTING, pf->state);
2685 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) ||
2686 test_bit(__I40E_RESET_INTR_RECEIVED, pf->state)) {
2687 dev_warn(&pf->pdev->dev,
2692 if (i40e_active_vfs(pf) || i40e_active_vmdqs(pf)) {
2693 dev_warn(&pf->pdev->dev,
2708 i40e_do_reset(pf, BIT(__I40E_PF_RESET_REQUESTED), true);
2723 clear_bit(__I40E_TESTING, pf->state);
2724 i40e_do_reset(pf, BIT(__I40E_PF_RESET_REQUESTED), true);
2730 netif_info(pf, drv, netdev, "online testing starting\n");
2741 netif_info(pf, drv, netdev, "testing finished\n");
2750 clear_bit(__I40E_TESTING, pf->state);
2751 netif_info(pf, drv, netdev, "testing failed\n");
2758 struct i40e_pf *pf = np->vsi->back;
2759 struct i40e_hw *hw = &pf->hw;
2769 wol->wolopts = (pf->wol_en ? WAKE_MAGIC : 0);
2781 struct i40e_pf *pf = np->vsi->back;
2783 struct i40e_hw *hw = &pf->hw;
2788 i40e_partition_setting_complaint(pf);
2805 if (pf->wol_en != !!wol->wolopts) {
2806 pf->wol_en = !!wol->wolopts;
2807 device_set_wakeup_enable(&pf->pdev->dev, pf->wol_en);
2817 struct i40e_pf *pf = np->vsi->back;
2818 struct i40e_hw *hw = &pf->hw;
2825 if (!test_bit(I40E_HW_CAP_PHY_CONTROLS_LEDS, pf->hw.caps)) {
2826 pf->led_status = i40e_led_get(hw);
2832 &pf->phy_led_val);
2833 pf->led_status = temp_status;
2837 if (!test_bit(I40E_HW_CAP_PHY_CONTROLS_LEDS, pf->hw.caps))
2840 ret = i40e_led_set_phy(hw, true, pf->led_status, 0);
2843 if (!test_bit(I40E_HW_CAP_PHY_CONTROLS_LEDS, pf->hw.caps))
2846 ret = i40e_led_set_phy(hw, false, pf->led_status, 0);
2849 if (!test_bit(I40E_HW_CAP_PHY_CONTROLS_LEDS, pf->hw.caps)) {
2850 i40e_led_set(hw, pf->led_status, false);
2852 ret = i40e_led_set_phy(hw, false, pf->led_status,
2853 (pf->phy_led_val |
2972 struct i40e_pf *pf = vsi->back;
2973 struct i40e_hw *hw = &pf->hw;
3022 struct i40e_pf *pf = vsi->back;
3035 netif_info(pf, drv, netdev, "Invalid queue value, queue range is 0 - %d\n",
3045 netif_info(pf, drv, netdev, "tx-usecs-high is not used, please program rx-usecs-high\n");
3050 netif_info(pf, drv, netdev, "Invalid value, rx-usecs-high range is 0-%lu\n",
3057 netif_info(pf, drv, netdev, "RX interrupt moderation cannot be changed if adaptive-rx is enabled.\n");
3062 netif_info(pf, drv, netdev, "Invalid value, rx-usecs range is 0-8160\n");
3068 netif_info(pf, drv, netdev, "TX interrupt moderation cannot be changed if adaptive-tx is enabled.\n");
3073 netif_info(pf, drv, netdev, "Invalid value, tx-usecs range is 0-8160\n");
3086 netif_info(pf, drv, netdev, "Interrupt rate limit rounded down to %d\n",
3136 * @pf: pointer to the physical function struct
3141 static int i40e_get_rss_hash_opts(struct i40e_pf *pf, struct ethtool_rxnfc *cmd)
3143 struct i40e_hw *hw = &pf->hw;
3318 * @pf: Pointer to the physical function struct
3327 static int i40e_get_ethtool_fdir_all(struct i40e_pf *pf,
3336 cmd->data = i40e_get_fd_cnt_all(pf);
3339 &pf->fdir_filter_list, fdir_node) {
3354 * @pf: Pointer to the physical function struct
3362 static int i40e_get_ethtool_fdir_entry(struct i40e_pf *pf,
3375 &pf->fdir_filter_list, fdir_node) {
3452 input_set = i40e_read_fd_input_set(pf, index);
3494 vsi = i40e_pf_get_main_vsi(pf);
3496 vsi = i40e_find_vsi_from_id(pf, rule->dest_vsi);
3532 struct i40e_pf *pf = vsi->back;
3541 ret = i40e_get_rss_hash_opts(pf, cmd);
3544 cmd->rule_cnt = pf->fdir_pf_active_filters;
3546 cmd->data = i40e_get_fd_cnt_all(pf);
3550 ret = i40e_get_ethtool_fdir_entry(pf, cmd);
3553 ret = i40e_get_ethtool_fdir_all(pf, cmd, rule_locs);
3618 * @pf: pointer to the physical function struct
3623 static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
3625 struct i40e_hw *hw = &pf->hw;
3633 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags)) {
3634 dev_err(&pf->pdev->dev,
3650 pf->hw.caps))
3657 pf->hw.caps))
3664 pf->hw.caps)) {
3675 pf->hw.caps)) {
3719 i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc);
3754 struct i40e_pf *pf = vsi->back;
3762 &pf->fdir_filter_list, fdir_node) {
3777 pf->fdir_pf_active_filters--;
3794 &pf->fdir_filter_list);
3797 pf->fdir_pf_active_filters++;
3804 * @pf: pointer to PF structure
3810 static void i40e_prune_flex_pit_list(struct i40e_pf *pf)
3816 list_for_each_entry_safe(entry, tmp, &pf->l3_flex_pit_list, list) {
3819 hlist_for_each_entry(rule, &pf->fdir_filter_list, fdir_node) {
3839 list_for_each_entry_safe(entry, tmp, &pf->l4_flex_pit_list, list) {
3842 hlist_for_each_entry(rule, &pf->fdir_filter_list, fdir_node) {
3880 struct i40e_pf *pf = vsi->back;
3883 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) ||
3884 test_bit(__I40E_RESET_INTR_RECEIVED, pf->state))
3887 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state))
3892 i40e_prune_flex_pit_list(pf);
3894 i40e_fdir_check_and_reenable(pf);
3900 * @pf: the PF data structure
3907 static u8 i40e_unused_pit_index(struct i40e_pf *pf)
3917 list_for_each_entry(entry, &pf->l4_flex_pit_list, list)
3920 list_for_each_entry(entry, &pf->l3_flex_pit_list, list)
4024 * @pf: Pointer to the PF structure
4043 static void __i40e_reprogram_flex_pit(struct i40e_pf *pf,
4077 i40e_write_rx_ctl(&pf->hw,
4085 i40e_write_rx_ctl(&pf->hw,
4103 i40e_write_rx_ctl(&pf->hw,
4113 * @pf: pointer to the PF structure
4118 static void i40e_reprogram_flex_pit(struct i40e_pf *pf)
4120 __i40e_reprogram_flex_pit(pf, &pf->l3_flex_pit_list,
4123 __i40e_reprogram_flex_pit(pf, &pf->l4_flex_pit_list,
4127 i40e_write_rx_ctl(&pf->hw,
4132 i40e_write_rx_ctl(&pf->hw,
4212 struct i40e_pf *pf = vsi->back;
4219 netif_info(pf, drv, vsi->netdev, "L3 source address: %s -> %s\n",
4226 netif_info(pf, drv, vsi->netdev, "L3 destination address: %s -> %s\n",
4233 netif_info(pf, drv, vsi->netdev, "L4 source port: %s -> %s\n",
4240 netif_info(pf, drv, vsi->netdev, "L4 destination port: %s -> %s\n",
4247 netif_info(pf, drv, vsi->netdev, "SCTP verification tag: %s -> %s\n",
4258 netif_info(pf, drv, vsi->netdev, "FLEX index %d: %s -> %s\n",
4264 netif_info(pf, drv, vsi->netdev, " Current input set: %0llx\n",
4266 netif_info(pf, drv, vsi->netdev, "Requested input set: %0llx\n",
4306 struct i40e_pf *pf = vsi->back;
4318 fdir_filter_count = &pf->fd_sctp4_filter_cnt;
4322 fdir_filter_count = &pf->fd_tcp4_filter_cnt;
4326 fdir_filter_count = &pf->fd_udp4_filter_cnt;
4330 fdir_filter_count = &pf->fd_sctp6_filter_cnt;
4334 fdir_filter_count = &pf->fd_tcp6_filter_cnt;
4338 fdir_filter_count = &pf->fd_udp6_filter_cnt;
4342 fdir_filter_count = &pf->fd_ip4_filter_cnt;
4347 fdir_filter_count = &pf->fd_ip6_filter_cnt;
4355 current_mask = i40e_read_fd_input_set(pf, index);
4562 dev_warn(&pf->pdev->dev,
4571 dev_warn(&pf->pdev->dev,
4581 flex_pit = i40e_find_flex_offset(&pf->l4_flex_pit_list,
4595 i40e_find_flex_offset(&pf->l3_flex_pit_list,
4625 pit_index = i40e_unused_pit_index(pf);
4641 netif_info(pf, drv, vsi->netdev, "Input set change requested for %s flows:\n",
4645 netif_info(pf, drv, vsi->netdev, "FLEX index %d: Offset -> %d",
4653 if (test_bit(I40E_FLAG_MFP_ENA, pf->flags)) {
4654 netif_err(pf, drv, vsi->netdev, "Cannot change Flow Director input sets while MFP is enabled\n");
4668 netif_err(pf, drv, vsi->netdev, "Cannot change input set for %s flows until %d preexisting filters are removed\n",
4674 i40e_write_fd_input_set(pf, index, new_mask);
4683 i40e_write_fd_input_set(pf, I40E_FILTER_PCTYPE_FRAG_IPV4,
4688 err = i40e_add_flex_offset(&pf->l4_flex_pit_list, src_offset,
4694 err = i40e_add_flex_offset(&pf->l3_flex_pit_list,
4701 i40e_reprogram_flex_pit(pf);
4762 struct i40e_pf *pf = vsi->back;
4768 &pf->fdir_filter_list, fdir_node) {
4780 dev_warn(&pf->pdev->dev,
4805 struct i40e_pf *pf;
4811 pf = vsi->back;
4813 if (!test_bit(I40E_FLAG_FD_SB_ENA, pf->flags))
4816 if (test_bit(__I40E_FD_SB_AUTO_DISABLED, pf->state))
4819 if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) ||
4820 test_bit(__I40E_RESET_INTR_RECEIVED, pf->state))
4823 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state))
4840 if (fsp->location >= (pf->hw.func_caps.fd_filters_best_effort +
4841 pf->hw.func_caps.fd_filters_guaranteed)) {
4862 if (vf >= pf->num_alloc_vfs)
4864 if (ring >= pf->vf[vf].num_queue_pairs)
4866 dest_vsi = pf->vf[vf].lan_vsi_id;
4882 input->cnt_index = I40E_FD_SB_STAT_IDX(pf->hw.pf_id);
4942 pf->fdir_pf_active_filters--;
4959 struct i40e_pf *pf = vsi->back;
4964 ret = i40e_set_rss_hash_opt(pf, cmd);
5004 struct i40e_pf *pf = vsi->back;
5010 ch->other_count = test_bit(I40E_FLAG_FD_SB_ENA, pf->flags) ? 1 : 0;
5032 struct i40e_pf *pf = vsi->back;
5045 if (i40e_is_tc_mqprio_enabled(pf))
5053 if (ch->other_count != (test_bit(I40E_FLAG_FD_SB_ENA, pf->flags) ? 1 : 0))
5064 &pf->fdir_filter_list, fdir_node) {
5066 dev_warn(&pf->pdev->dev,
5074 dev_err(&pf->pdev->dev,
5086 new_count = i40e_reconfig_rss_queues(pf, count);
5168 struct i40e_pf *pf = vsi->back;
5197 i40e_fill_rss_lut(pf, vsi->rss_lut_user, I40E_HLUT_ARRAY_SIZE,
5218 struct i40e_pf *pf = vsi->back;
5226 if (test_bit(priv_flag->bitno, pf->flags))
5230 if (pf->hw.pf_id != 0)
5238 if (test_bit(priv_flag->bitno, pf->flags))
5258 struct i40e_pf *pf = vsi->back;
5263 bitmap_copy(orig_flags, pf->flags, I40E_PF_FLAGS_NBITS);
5264 bitmap_copy(new_flags, pf->flags, I40E_PF_FLAGS_NBITS);
5284 if (pf->hw.pf_id != 0)
5306 bitmap_xor(changed_flags, pf->flags, orig_flags, I40E_PF_FLAGS_NBITS);
5322 !test_bit(I40E_HW_CAP_ATR_EVICT, pf->hw.caps))
5334 !test_bit(I40E_HW_CAP_FW_LLDP_STOPPABLE, pf->hw.caps)) {
5335 dev_warn(&pf->pdev->dev,
5341 pf->hw.device_id != I40E_DEV_ID_25G_SFP28 &&
5342 pf->hw.device_id != I40E_DEV_ID_25G_B) {
5343 dev_warn(&pf->pdev->dev,
5349 pf->hw.device_id != I40E_DEV_ID_25G_SFP28 &&
5350 pf->hw.device_id != I40E_DEV_ID_25G_B &&
5351 pf->hw.device_id != I40E_DEV_ID_KX_X722) {
5352 dev_warn(&pf->pdev->dev,
5365 set_bit(__I40E_FD_ATR_AUTO_DISABLED, pf->state);
5366 set_bit(__I40E_FD_FLUSH_REQUESTED, pf->state);
5376 ret = i40e_aq_set_switch_config(&pf->hw, sw_flags, valid_flags,
5378 if (ret && pf->hw.aq.asq_last_status != I40E_AQ_RC_ESRCH) {
5379 dev_info(&pf->pdev->dev,
5382 i40e_aq_str(&pf->hw,
5383 pf->hw.aq.asq_last_status));
5403 dev_warn(&pf->pdev->dev, "Cannot change FEC config\n");
5408 dev_err(&pf->pdev->dev,
5414 pf->num_alloc_vfs) {
5415 dev_warn(&pf->pdev->dev,
5422 dev_warn(&pf->pdev->dev,
5430 dev_warn(&pf->pdev->dev,
5436 i40e_dcb_sw_default_config(pf);
5438 i40e_aq_cfg_lldp_mib_change_event(&pf->hw, false, NULL);
5439 i40e_aq_stop_lldp(&pf->hw, true, false, NULL);
5441 status = i40e_aq_start_lldp(&pf->hw, false, NULL);
5443 adq_err = pf->hw.aq.asq_last_status;
5446 dev_warn(&pf->pdev->dev,
5451 dev_warn(&pf->pdev->dev,
5455 dev_warn(&pf->pdev->dev,
5459 dev_warn(&pf->pdev->dev,
5462 i40e_aq_str(&pf->hw,
5475 bitmap_copy(pf->flags, new_flags, I40E_PF_FLAGS_NBITS);
5481 i40e_do_reset(pf, reset_needed, true);
5496 struct i40e_pf *pf = vsi->back;
5497 struct i40e_hw *hw = &pf->hw;
5603 struct i40e_pf *pf = vsi->back;
5604 struct i40e_hw *hw = &pf->hw;
5649 struct i40e_pf *pf = vsi->back;
5650 struct i40e_hw *hw = &pf->hw;
5670 edata->tx_lpi_enabled = pf->stats.tx_lpi_status;
5672 edata->eee_active = pf->stats.tx_lpi_status && pf->stats.rx_lpi_status;
5682 struct i40e_pf *pf = vsi->back;
5688 {edata->tx_lpi_enabled != pf->stats.tx_lpi_status, "tx-lpi"}
5710 struct i40e_pf *pf = vsi->back;
5711 struct i40e_hw *hw = &pf->hw;
5831 struct i40e_pf *pf = np->vsi->back;
5833 if (!test_bit(__I40E_RECOVERY_MODE, pf->state))