Lines Matching full:pf

13 #define ENETC_DRV_NAME_STR "ENETC PF driver"
34 static struct phylink_pcs *enetc_pf_create_pcs(struct enetc_pf *pf, in enetc_pf_create_pcs() argument
53 static void enetc_enable_si_vlan_promisc(struct enetc_pf *pf, int si_idx) in enetc_enable_si_vlan_promisc() argument
55 pf->vlan_promisc_simap |= BIT(si_idx); in enetc_enable_si_vlan_promisc()
56 enetc_set_vlan_promisc(&pf->si->hw, pf->vlan_promisc_simap); in enetc_enable_si_vlan_promisc()
59 static void enetc_disable_si_vlan_promisc(struct enetc_pf *pf, int si_idx) in enetc_disable_si_vlan_promisc() argument
61 pf->vlan_promisc_simap &= ~BIT(si_idx); in enetc_disable_si_vlan_promisc()
62 enetc_set_vlan_promisc(&pf->si->hw, pf->vlan_promisc_simap); in enetc_disable_si_vlan_promisc()
148 static void enetc_sync_mac_filters(struct enetc_pf *pf) in enetc_sync_mac_filters() argument
150 struct enetc_mac_filter *f = pf->mac_filter; in enetc_sync_mac_filters()
151 struct enetc_si *si = pf->si; in enetc_sync_mac_filters()
195 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_rx_mode() local
204 /* enable promisc mode for SI0 (PF) */ in enetc_pf_set_rx_mode()
209 /* enable multi cast promisc mode for SI0 (PF) */ in enetc_pf_set_rx_mode()
214 /* first 2 filter entries belong to PF */ in enetc_pf_set_rx_mode()
217 filter = &pf->mac_filter[UC]; in enetc_pf_set_rx_mode()
233 filter = &pf->mac_filter[MC]; in enetc_pf_set_rx_mode()
245 /* update PF entries */ in enetc_pf_set_rx_mode()
246 enetc_sync_mac_filters(pf); in enetc_pf_set_rx_mode()
271 static void enetc_sync_vlan_ht_filter(struct enetc_pf *pf, bool rehash) in enetc_sync_vlan_ht_filter() argument
276 bitmap_zero(pf->vlan_ht_filter, ENETC_VLAN_HT_SIZE); in enetc_sync_vlan_ht_filter()
278 for_each_set_bit(i, pf->active_vlans, VLAN_N_VID) { in enetc_sync_vlan_ht_filter()
281 __set_bit(hidx, pf->vlan_ht_filter); in enetc_sync_vlan_ht_filter()
285 enetc_set_vlan_ht_filter(&pf->si->hw, 0, *pf->vlan_ht_filter); in enetc_sync_vlan_ht_filter()
291 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_vlan_rx_add_vid() local
294 __set_bit(vid, pf->active_vlans); in enetc_vlan_rx_add_vid()
297 if (!__test_and_set_bit(idx, pf->vlan_ht_filter)) in enetc_vlan_rx_add_vid()
298 enetc_sync_vlan_ht_filter(pf, false); in enetc_vlan_rx_add_vid()
306 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_vlan_rx_del_vid() local
308 __clear_bit(vid, pf->active_vlans); in enetc_vlan_rx_del_vid()
309 enetc_sync_vlan_ht_filter(pf, true); in enetc_vlan_rx_del_vid()
340 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_vf_mac() local
343 if (vf >= pf->total_vfs) in enetc_pf_set_vf_mac()
349 vf_state = &pf->vf_state[vf]; in enetc_pf_set_vf_mac()
359 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_vf_vlan() local
364 if (vf >= pf->total_vfs) in enetc_pf_set_vf_vlan()
378 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_vf_spoofchk() local
381 if (vf >= pf->total_vfs) in enetc_pf_set_vf_spoofchk()
393 struct enetc_pf *pf = enetc_si_priv(si); in enetc_port_assign_rfs_entries() local
401 vf_entries = num_entries / (pf->total_vfs + 1); in enetc_port_assign_rfs_entries()
403 for (i = 0; i < pf->total_vfs; i++) in enetc_port_assign_rfs_entries()
406 num_entries - vf_entries * pf->total_vfs); in enetc_port_assign_rfs_entries()
431 struct enetc_pf *pf = enetc_si_priv(si); in enetc_port_si_configure() local
454 /* Add default one-time settings for SI0 (PF) */ in enetc_port_si_configure()
467 num_rings /= pf->total_vfs; in enetc_port_si_configure()
472 for (i = 0; i < pf->total_vfs; i++) in enetc_port_si_configure()
550 static void enetc_configure_port(struct enetc_pf *pf) in enetc_configure_port() argument
553 struct enetc_hw *hw = &pf->si->hw; in enetc_configure_port()
555 enetc_configure_port_mac(pf->si); in enetc_configure_port()
557 enetc_port_si_configure(pf->si); in enetc_configure_port()
564 enetc_port_assign_rfs_entries(pf->si); in enetc_configure_port()
567 pf->vlan_promisc_simap = ENETC_VLAN_PROMISC_MAP_ALL; in enetc_configure_port()
568 enetc_set_vlan_promisc(hw, pf->vlan_promisc_simap); in enetc_configure_port()
577 static u16 enetc_msg_pf_set_vf_primary_mac_addr(struct enetc_pf *pf, in enetc_msg_pf_set_vf_primary_mac_addr() argument
580 struct enetc_vf_state *vf_state = &pf->vf_state[vf_id]; in enetc_msg_pf_set_vf_primary_mac_addr()
581 struct enetc_msg_swbd *msg = &pf->rxmsg[vf_id]; in enetc_msg_pf_set_vf_primary_mac_addr()
583 struct device *dev = &pf->si->pdev->dev; in enetc_msg_pf_set_vf_primary_mac_addr()
594 dev_warn(dev, "Attempt to override PF set mac addr for VF%d\n", in enetc_msg_pf_set_vf_primary_mac_addr()
597 enetc_pf_set_primary_mac_addr(&pf->si->hw, vf_id + 1, addr); in enetc_msg_pf_set_vf_primary_mac_addr()
602 void enetc_msg_handle_rxmsg(struct enetc_pf *pf, int vf_id, u16 *status) in enetc_msg_handle_rxmsg() argument
604 struct enetc_msg_swbd *msg = &pf->rxmsg[vf_id]; in enetc_msg_handle_rxmsg()
605 struct device *dev = &pf->si->pdev->dev; in enetc_msg_handle_rxmsg()
615 *status = enetc_msg_pf_set_vf_primary_mac_addr(pf, vf_id); in enetc_msg_handle_rxmsg()
627 struct enetc_pf *pf = enetc_si_priv(si); in enetc_sriov_configure() local
631 enetc_msg_psi_free(pf); in enetc_sriov_configure()
632 pf->num_vfs = 0; in enetc_sriov_configure()
635 pf->num_vfs = num_vfs; in enetc_sriov_configure()
637 err = enetc_msg_psi_init(pf); in enetc_sriov_configure()
653 enetc_msg_psi_free(pf); in enetc_sriov_configure()
655 pf->num_vfs = 0; in enetc_sriov_configure()
677 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_features() local
680 enetc_disable_si_vlan_promisc(pf, 0); in enetc_pf_set_features()
682 enetc_enable_si_vlan_promisc(pf, 0); in enetc_pf_set_features()
736 struct enetc_pf *pf = phylink_to_enetc_pf(config); in enetc_pl_mac_select_pcs() local
738 return pf->pcs; in enetc_pl_mac_select_pcs()
745 struct enetc_pf *pf = phylink_to_enetc_pf(config); in enetc_pl_mac_config() local
747 enetc_mac_config(pf->si, state->interface); in enetc_pl_mac_config()
783 struct enetc_pf *pf = phylink_to_enetc_pf(config); in enetc_pl_mac_link_up() local
786 struct enetc_hw *hw = &pf->si->hw; in enetc_pl_mac_link_up()
787 struct enetc_si *si = pf->si; in enetc_pl_mac_link_up()
792 priv = netdev_priv(pf->si->ndev); in enetc_pl_mac_link_up()
794 if (pf->si->hw_features & ENETC_SI_F_QBV) in enetc_pl_mac_link_up()
859 struct enetc_pf *pf = phylink_to_enetc_pf(config); in enetc_pl_mac_link_down() local
860 struct enetc_si *si = pf->si; in enetc_pl_mac_link_down()
879 * of this port (PF + VFs)
956 dev_err(&pdev->dev, "could not map PF space, probing a VF?\n"); in enetc_psi_create()
963 dev_err(&pdev->dev, "Could not get PF driver data\n"); in enetc_psi_create()
1017 struct enetc_pf *pf; in enetc_pf_probe() local
1034 pf = enetc_si_priv(si); in enetc_pf_probe()
1035 pf->si = si; in enetc_pf_probe()
1036 pf->ops = &enetc_pf_ops; in enetc_pf_probe()
1038 pf->total_vfs = pci_sriov_get_totalvfs(pdev); in enetc_pf_probe()
1039 if (pf->total_vfs) { in enetc_pf_probe()
1040 pf->vf_state = kcalloc(pf->total_vfs, sizeof(struct enetc_vf_state), in enetc_pf_probe()
1042 if (!pf->vf_state) in enetc_pf_probe()
1046 err = enetc_setup_mac_addresses(node, pf); in enetc_pf_probe()
1050 enetc_configure_port(pf); in enetc_pf_probe()
1087 err = of_get_phy_mode(node, &pf->if_mode); in enetc_pf_probe()
1093 err = enetc_mdiobus_create(pf, node); in enetc_pf_probe()
1110 enetc_mdiobus_destroy(pf); in enetc_pf_probe()
1122 kfree(pf->vf_state); in enetc_pf_probe()
1132 struct enetc_pf *pf = enetc_si_priv(si); in enetc_pf_remove() local
1137 if (pf->num_vfs) in enetc_pf_remove()
1143 enetc_mdiobus_destroy(pf); in enetc_pf_remove()
1150 kfree(pf->vf_state); in enetc_pf_remove()