Lines Matching full:pf

15 #define ENETC_DRV_NAME_STR "ENETC PF driver"
58 static void enetc_enable_si_vlan_promisc(struct enetc_pf *pf, int si_idx) in enetc_enable_si_vlan_promisc() argument
60 pf->vlan_promisc_simap |= BIT(si_idx); in enetc_enable_si_vlan_promisc()
61 enetc_set_vlan_promisc(&pf->si->hw, pf->vlan_promisc_simap); in enetc_enable_si_vlan_promisc()
64 static void enetc_disable_si_vlan_promisc(struct enetc_pf *pf, int si_idx) in enetc_disable_si_vlan_promisc() argument
66 pf->vlan_promisc_simap &= ~BIT(si_idx); in enetc_disable_si_vlan_promisc()
67 enetc_set_vlan_promisc(&pf->si->hw, pf->vlan_promisc_simap); in enetc_disable_si_vlan_promisc()
153 static void enetc_sync_mac_filters(struct enetc_pf *pf) in enetc_sync_mac_filters() argument
155 struct enetc_mac_filter *f = pf->mac_filter; in enetc_sync_mac_filters()
156 struct enetc_si *si = pf->si; in enetc_sync_mac_filters()
200 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_rx_mode() local
209 /* enable promisc mode for SI0 (PF) */ in enetc_pf_set_rx_mode()
214 /* enable multi cast promisc mode for SI0 (PF) */ in enetc_pf_set_rx_mode()
219 /* first 2 filter entries belong to PF */ in enetc_pf_set_rx_mode()
222 filter = &pf->mac_filter[UC]; in enetc_pf_set_rx_mode()
238 filter = &pf->mac_filter[MC]; in enetc_pf_set_rx_mode()
250 /* update PF entries */ in enetc_pf_set_rx_mode()
251 enetc_sync_mac_filters(pf); in enetc_pf_set_rx_mode()
276 static void enetc_sync_vlan_ht_filter(struct enetc_pf *pf, bool rehash) in enetc_sync_vlan_ht_filter() argument
281 bitmap_zero(pf->vlan_ht_filter, ENETC_VLAN_HT_SIZE); in enetc_sync_vlan_ht_filter()
283 for_each_set_bit(i, pf->active_vlans, VLAN_N_VID) { in enetc_sync_vlan_ht_filter()
286 __set_bit(hidx, pf->vlan_ht_filter); in enetc_sync_vlan_ht_filter()
290 enetc_set_vlan_ht_filter(&pf->si->hw, 0, *pf->vlan_ht_filter); in enetc_sync_vlan_ht_filter()
296 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_vlan_rx_add_vid() local
299 __set_bit(vid, pf->active_vlans); in enetc_vlan_rx_add_vid()
302 if (!__test_and_set_bit(idx, pf->vlan_ht_filter)) in enetc_vlan_rx_add_vid()
303 enetc_sync_vlan_ht_filter(pf, false); in enetc_vlan_rx_add_vid()
311 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_vlan_rx_del_vid() local
313 __clear_bit(vid, pf->active_vlans); in enetc_vlan_rx_del_vid()
314 enetc_sync_vlan_ht_filter(pf, true); in enetc_vlan_rx_del_vid()
345 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_vf_mac() local
348 if (vf >= pf->total_vfs) in enetc_pf_set_vf_mac()
354 vf_state = &pf->vf_state[vf]; in enetc_pf_set_vf_mac()
364 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_vf_vlan() local
369 if (vf >= pf->total_vfs) in enetc_pf_set_vf_vlan()
383 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_vf_spoofchk() local
386 if (vf >= pf->total_vfs) in enetc_pf_set_vf_spoofchk()
396 static int enetc_setup_mac_address(struct device_node *np, struct enetc_pf *pf, in enetc_setup_mac_address() argument
399 struct device *dev = &pf->si->pdev->dev; in enetc_setup_mac_address()
400 struct enetc_hw *hw = &pf->si->hw; in enetc_setup_mac_address()
428 struct enetc_pf *pf) in enetc_setup_mac_addresses() argument
432 /* The PF might take its MAC from the device tree */ in enetc_setup_mac_addresses()
433 err = enetc_setup_mac_address(np, pf, 0); in enetc_setup_mac_addresses()
437 for (i = 0; i < pf->total_vfs; i++) { in enetc_setup_mac_addresses()
438 err = enetc_setup_mac_address(NULL, pf, i + 1); in enetc_setup_mac_addresses()
448 struct enetc_pf *pf = enetc_si_priv(si); in enetc_port_assign_rfs_entries() local
456 vf_entries = num_entries / (pf->total_vfs + 1); in enetc_port_assign_rfs_entries()
458 for (i = 0; i < pf->total_vfs; i++) in enetc_port_assign_rfs_entries()
461 num_entries - vf_entries * pf->total_vfs); in enetc_port_assign_rfs_entries()
469 struct enetc_pf *pf = enetc_si_priv(si); in enetc_port_si_configure() local
490 /* Add default one-time settings for SI0 (PF) */ in enetc_port_si_configure()
503 num_rings /= pf->total_vfs; in enetc_port_si_configure()
508 for (i = 0; i < pf->total_vfs; i++) in enetc_port_si_configure()
586 static void enetc_configure_port(struct enetc_pf *pf) in enetc_configure_port() argument
589 struct enetc_hw *hw = &pf->si->hw; in enetc_configure_port()
591 enetc_configure_port_mac(pf->si); in enetc_configure_port()
593 enetc_port_si_configure(pf->si); in enetc_configure_port()
600 enetc_port_assign_rfs_entries(pf->si); in enetc_configure_port()
603 pf->vlan_promisc_simap = ENETC_VLAN_PROMISC_MAP_ALL; in enetc_configure_port()
604 enetc_set_vlan_promisc(hw, pf->vlan_promisc_simap); in enetc_configure_port()
613 static u16 enetc_msg_pf_set_vf_primary_mac_addr(struct enetc_pf *pf, in enetc_msg_pf_set_vf_primary_mac_addr() argument
616 struct enetc_vf_state *vf_state = &pf->vf_state[vf_id]; in enetc_msg_pf_set_vf_primary_mac_addr()
617 struct enetc_msg_swbd *msg = &pf->rxmsg[vf_id]; in enetc_msg_pf_set_vf_primary_mac_addr()
619 struct device *dev = &pf->si->pdev->dev; in enetc_msg_pf_set_vf_primary_mac_addr()
630 dev_warn(dev, "Attempt to override PF set mac addr for VF%d\n", in enetc_msg_pf_set_vf_primary_mac_addr()
633 enetc_pf_set_primary_mac_addr(&pf->si->hw, vf_id + 1, addr); in enetc_msg_pf_set_vf_primary_mac_addr()
638 void enetc_msg_handle_rxmsg(struct enetc_pf *pf, int vf_id, u16 *status) in enetc_msg_handle_rxmsg() argument
640 struct enetc_msg_swbd *msg = &pf->rxmsg[vf_id]; in enetc_msg_handle_rxmsg()
641 struct device *dev = &pf->si->pdev->dev; in enetc_msg_handle_rxmsg()
651 *status = enetc_msg_pf_set_vf_primary_mac_addr(pf, vf_id); in enetc_msg_handle_rxmsg()
663 struct enetc_pf *pf = enetc_si_priv(si); in enetc_sriov_configure() local
667 enetc_msg_psi_free(pf); in enetc_sriov_configure()
668 pf->num_vfs = 0; in enetc_sriov_configure()
671 pf->num_vfs = num_vfs; in enetc_sriov_configure()
673 err = enetc_msg_psi_init(pf); in enetc_sriov_configure()
689 enetc_msg_psi_free(pf); in enetc_sriov_configure()
691 pf->num_vfs = 0; in enetc_sriov_configure()
713 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_features() local
716 enetc_disable_si_vlan_promisc(pf, 0); in enetc_pf_set_features()
718 enetc_enable_si_vlan_promisc(pf, 0); in enetc_pf_set_features()
815 static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np) in enetc_mdio_probe() argument
817 struct device *dev = &pf->si->pdev->dev; in enetc_mdio_probe()
833 mdio_priv->hw = &pf->si->hw; in enetc_mdio_probe()
841 pf->mdio = bus; in enetc_mdio_probe()
846 static void enetc_mdio_remove(struct enetc_pf *pf) in enetc_mdio_remove() argument
848 if (pf->mdio) in enetc_mdio_remove()
849 mdiobus_unregister(pf->mdio); in enetc_mdio_remove()
852 static int enetc_imdio_create(struct enetc_pf *pf) in enetc_imdio_create() argument
854 struct device *dev = &pf->si->pdev->dev; in enetc_imdio_create()
872 mdio_priv->hw = &pf->si->hw; in enetc_imdio_create()
889 pf->imdio = bus; in enetc_imdio_create()
890 pf->pcs = phylink_pcs; in enetc_imdio_create()
901 static void enetc_imdio_remove(struct enetc_pf *pf) in enetc_imdio_remove() argument
903 if (pf->pcs) in enetc_imdio_remove()
904 lynx_pcs_destroy(pf->pcs); in enetc_imdio_remove()
905 if (pf->imdio) { in enetc_imdio_remove()
906 mdiobus_unregister(pf->imdio); in enetc_imdio_remove()
907 mdiobus_free(pf->imdio); in enetc_imdio_remove()
911 static bool enetc_port_has_pcs(struct enetc_pf *pf) in enetc_port_has_pcs() argument
913 return (pf->if_mode == PHY_INTERFACE_MODE_SGMII || in enetc_port_has_pcs()
914 pf->if_mode == PHY_INTERFACE_MODE_2500BASEX || in enetc_port_has_pcs()
915 pf->if_mode == PHY_INTERFACE_MODE_USXGMII); in enetc_port_has_pcs()
918 static int enetc_mdiobus_create(struct enetc_pf *pf, struct device_node *node) in enetc_mdiobus_create() argument
925 err = enetc_mdio_probe(pf, mdio_np); in enetc_mdiobus_create()
932 if (enetc_port_has_pcs(pf)) { in enetc_mdiobus_create()
933 err = enetc_imdio_create(pf); in enetc_mdiobus_create()
935 enetc_mdio_remove(pf); in enetc_mdiobus_create()
943 static void enetc_mdiobus_destroy(struct enetc_pf *pf) in enetc_mdiobus_destroy() argument
945 enetc_mdio_remove(pf); in enetc_mdiobus_destroy()
946 enetc_imdio_remove(pf); in enetc_mdiobus_destroy()
952 struct enetc_pf *pf = phylink_to_enetc_pf(config); in enetc_pl_mac_select_pcs() local
954 return pf->pcs; in enetc_pl_mac_select_pcs()
961 struct enetc_pf *pf = phylink_to_enetc_pf(config); in enetc_pl_mac_config() local
963 enetc_mac_config(pf->si, state->interface); in enetc_pl_mac_config()
999 struct enetc_pf *pf = phylink_to_enetc_pf(config); in enetc_pl_mac_link_up() local
1002 struct enetc_hw *hw = &pf->si->hw; in enetc_pl_mac_link_up()
1003 struct enetc_si *si = pf->si; in enetc_pl_mac_link_up()
1008 priv = netdev_priv(pf->si->ndev); in enetc_pl_mac_link_up()
1010 if (pf->si->hw_features & ENETC_SI_F_QBV) in enetc_pl_mac_link_up()
1075 struct enetc_pf *pf = phylink_to_enetc_pf(config); in enetc_pl_mac_link_down() local
1076 struct enetc_si *si = pf->si; in enetc_pl_mac_link_down()
1097 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_phylink_create() local
1101 pf->phylink_config.dev = &priv->ndev->dev; in enetc_phylink_create()
1102 pf->phylink_config.type = PHYLINK_NETDEV; in enetc_phylink_create()
1103 pf->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | in enetc_phylink_create()
1107 pf->phylink_config.supported_interfaces); in enetc_phylink_create()
1109 pf->phylink_config.supported_interfaces); in enetc_phylink_create()
1111 pf->phylink_config.supported_interfaces); in enetc_phylink_create()
1113 pf->phylink_config.supported_interfaces); in enetc_phylink_create()
1114 phy_interface_set_rgmii(pf->phylink_config.supported_interfaces); in enetc_phylink_create()
1116 phylink = phylink_create(&pf->phylink_config, of_fwnode_handle(node), in enetc_phylink_create()
1117 pf->if_mode, &enetc_mac_phylink_ops); in enetc_phylink_create()
1134 * of this port (PF + VFs)
1211 dev_err(&pdev->dev, "could not map PF space, probing a VF?\n"); in enetc_psi_create()
1257 struct enetc_pf *pf; in enetc_pf_probe() local
1274 pf = enetc_si_priv(si); in enetc_pf_probe()
1275 pf->si = si; in enetc_pf_probe()
1276 pf->total_vfs = pci_sriov_get_totalvfs(pdev); in enetc_pf_probe()
1277 if (pf->total_vfs) { in enetc_pf_probe()
1278 pf->vf_state = kcalloc(pf->total_vfs, sizeof(struct enetc_vf_state), in enetc_pf_probe()
1280 if (!pf->vf_state) in enetc_pf_probe()
1284 err = enetc_setup_mac_addresses(node, pf); in enetc_pf_probe()
1288 enetc_configure_port(pf); in enetc_pf_probe()
1325 err = of_get_phy_mode(node, &pf->if_mode); in enetc_pf_probe()
1331 err = enetc_mdiobus_create(pf, node); in enetc_pf_probe()
1348 enetc_mdiobus_destroy(pf); in enetc_pf_probe()
1360 kfree(pf->vf_state); in enetc_pf_probe()
1370 struct enetc_pf *pf = enetc_si_priv(si); in enetc_pf_remove() local
1375 if (pf->num_vfs) in enetc_pf_remove()
1381 enetc_mdiobus_destroy(pf); in enetc_pf_remove()
1388 kfree(pf->vf_state); in enetc_pf_remove()