Lines Matching refs:si

17 static void enetc_pf_get_primary_mac_addr(struct enetc_hw *hw, int si, u8 *addr)  in enetc_pf_get_primary_mac_addr()  argument
19 u32 upper = __raw_readl(hw->port + ENETC_PSIPMAR0(si)); in enetc_pf_get_primary_mac_addr()
20 u16 lower = __raw_readw(hw->port + ENETC_PSIPMAR1(si)); in enetc_pf_get_primary_mac_addr()
26 static void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si, in enetc_pf_set_primary_mac_addr() argument
32 __raw_writel(upper, hw->port + ENETC_PSIPMAR0(si)); in enetc_pf_set_primary_mac_addr()
33 __raw_writew(lower, hw->port + ENETC_PSIPMAR1(si)); in enetc_pf_set_primary_mac_addr()
45 enetc_pf_set_primary_mac_addr(&priv->si->hw, 0, saddr->sa_data); in enetc_pf_set_mac_addr()
61 enetc_set_vlan_promisc(&pf->si->hw, pf->vlan_promisc_simap); in enetc_enable_si_vlan_promisc()
67 enetc_set_vlan_promisc(&pf->si->hw, pf->vlan_promisc_simap); in enetc_disable_si_vlan_promisc()
70 static void enetc_set_isol_vlan(struct enetc_hw *hw, int si, u16 vlan, u8 qos) in enetc_set_isol_vlan() argument
77 enetc_port_wr(hw, ENETC_PSIVLANR(si), val); in enetc_set_isol_vlan()
122 static void enetc_clear_mac_ht_flt(struct enetc_si *si, int si_idx, int type) in enetc_clear_mac_ht_flt() argument
124 bool err = si->errata & ENETC_ERR_UCMCSWP; in enetc_clear_mac_ht_flt()
127 enetc_port_wr(&si->hw, ENETC_PSIUMHFR0(si_idx, err), 0); in enetc_clear_mac_ht_flt()
128 enetc_port_wr(&si->hw, ENETC_PSIUMHFR1(si_idx), 0); in enetc_clear_mac_ht_flt()
130 enetc_port_wr(&si->hw, ENETC_PSIMMHFR0(si_idx, err), 0); in enetc_clear_mac_ht_flt()
131 enetc_port_wr(&si->hw, ENETC_PSIMMHFR1(si_idx), 0); in enetc_clear_mac_ht_flt()
135 static void enetc_set_mac_ht_flt(struct enetc_si *si, int si_idx, int type, in enetc_set_mac_ht_flt() argument
138 bool err = si->errata & ENETC_ERR_UCMCSWP; in enetc_set_mac_ht_flt()
141 enetc_port_wr(&si->hw, ENETC_PSIUMHFR0(si_idx, err), in enetc_set_mac_ht_flt()
143 enetc_port_wr(&si->hw, ENETC_PSIUMHFR1(si_idx), in enetc_set_mac_ht_flt()
146 enetc_port_wr(&si->hw, ENETC_PSIMMHFR0(si_idx, err), in enetc_set_mac_ht_flt()
148 enetc_port_wr(&si->hw, ENETC_PSIMMHFR1(si_idx), in enetc_set_mac_ht_flt()
156 struct enetc_si *si = pf->si; in enetc_sync_mac_filters() local
167 enetc_clear_mac_flt_entry(si, pos); in enetc_sync_mac_filters()
169 enetc_clear_mac_ht_flt(si, 0, i); in enetc_sync_mac_filters()
177 enetc_clear_mac_ht_flt(si, 0, UC); in enetc_sync_mac_filters()
179 err = enetc_set_mac_flt_entry(si, pos, f->mac_addr, in enetc_sync_mac_filters()
185 dev_warn(&si->pdev->dev, "fallback to HT filt (%d)\n", in enetc_sync_mac_filters()
191 enetc_clear_mac_flt_entry(si, pos); in enetc_sync_mac_filters()
193 enetc_set_mac_ht_flt(si, 0, i, *f->mac_hash_table); in enetc_sync_mac_filters()
200 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_rx_mode()
201 struct enetc_hw *hw = &priv->si->hw; in enetc_pf_set_rx_mode()
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()
311 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_vlan_rx_del_vid()
322 struct enetc_si *si = priv->si; in enetc_set_loopback() local
325 reg = enetc_port_mac_rd(si, ENETC_PM0_IF_MODE); in enetc_set_loopback()
330 enetc_port_mac_wr(si, ENETC_PM0_IF_MODE, reg); in enetc_set_loopback()
333 reg = enetc_port_mac_rd(si, ENETC_PM0_CMD_CFG); in enetc_set_loopback()
338 enetc_port_mac_wr(si, ENETC_PM0_CMD_CFG, reg); in enetc_set_loopback()
345 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_vf_mac()
356 enetc_pf_set_primary_mac_addr(&priv->si->hw, vf + 1, mac); in enetc_pf_set_vf_mac()
364 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_vf_vlan()
366 if (priv->si->errata & ENETC_ERR_VLAN_ISOL) in enetc_pf_set_vf_vlan()
376 enetc_set_isol_vlan(&priv->si->hw, vf + 1, vlan, qos); in enetc_pf_set_vf_vlan()
383 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_vf_spoofchk()
389 cfgr = enetc_port_rd(&priv->si->hw, ENETC_PSICFGR0(vf + 1)); in enetc_pf_set_vf_spoofchk()
391 enetc_port_wr(&priv->si->hw, ENETC_PSICFGR0(vf + 1), cfgr); in enetc_pf_set_vf_spoofchk()
397 int si) 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()
413 enetc_pf_get_primary_mac_addr(hw, si, mac_addr); in enetc_setup_mac_address()
419 si, mac_addr); in enetc_setup_mac_address()
422 enetc_pf_set_primary_mac_addr(hw, si, mac_addr); in enetc_setup_mac_address()
446 static void enetc_port_assign_rfs_entries(struct enetc_si *si) in enetc_port_assign_rfs_entries() argument
448 struct enetc_pf *pf = enetc_si_priv(si); in enetc_port_assign_rfs_entries()
449 struct enetc_hw *hw = &si->hw; in enetc_port_assign_rfs_entries()
467 static void enetc_port_si_configure(struct enetc_si *si) in enetc_port_si_configure() argument
469 struct enetc_pf *pf = enetc_si_priv(si); in enetc_port_si_configure()
470 struct enetc_hw *hw = &si->hw; in enetc_port_si_configure()
484 dev_warn(&si->pdev->dev, "Found %d rings, expected %d!\n", in enetc_port_si_configure()
540 static void enetc_configure_port_mac(struct enetc_si *si) in enetc_configure_port_mac() argument
542 struct enetc_hw *hw = &si->hw; in enetc_configure_port_mac()
544 enetc_port_mac_wr(si, ENETC_PM0_MAXFRM, in enetc_configure_port_mac()
549 enetc_port_mac_wr(si, ENETC_PM0_CMD_CFG, ENETC_PM0_CMD_PHY_TX_EN | in enetc_configure_port_mac()
556 enetc_port_mac_wr(si, ENETC_PM0_RX_FIFO, ENETC_PM0_RX_FIFO_VAL); in enetc_configure_port_mac()
559 static void enetc_mac_config(struct enetc_si *si, phy_interface_t phy_mode) in enetc_mac_config() argument
564 val = enetc_port_mac_rd(si, ENETC_PM0_IF_MODE); in enetc_mac_config()
567 enetc_port_mac_wr(si, ENETC_PM0_IF_MODE, val); in enetc_mac_config()
572 enetc_port_mac_wr(si, ENETC_PM0_IF_MODE, val); in enetc_mac_config()
576 static void enetc_mac_enable(struct enetc_si *si, bool en) in enetc_mac_enable() argument
578 u32 val = enetc_port_mac_rd(si, ENETC_PM0_CMD_CFG); in enetc_mac_enable()
583 enetc_port_mac_wr(si, ENETC_PM0_CMD_CFG, val); in enetc_mac_enable()
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()
619 struct device *dev = &pf->si->pdev->dev; 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()
641 struct device *dev = &pf->si->pdev->dev; in enetc_msg_handle_rxmsg()
662 struct enetc_si *si = pci_get_drvdata(pdev); in enetc_sriov_configure() local
663 struct enetc_pf *pf = enetc_si_priv(si); in enetc_sriov_configure()
722 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_pf_set_features()
778 static void enetc_pf_netdev_setup(struct enetc_si *si, struct net_device *ndev, in enetc_pf_netdev_setup() argument
783 SET_NETDEV_DEV(ndev, &si->pdev->dev); in enetc_pf_netdev_setup()
785 priv->si = si; in enetc_pf_netdev_setup()
786 priv->dev = &si->pdev->dev; in enetc_pf_netdev_setup()
787 si->ndev = ndev; in enetc_pf_netdev_setup()
806 if (si->num_rss) in enetc_pf_netdev_setup()
814 if (si->hw_features & ENETC_SI_F_PSFP && !enetc_psfp_enable(priv)) { in enetc_pf_netdev_setup()
821 enetc_load_primary_mac_addr(&si->hw, ndev); in enetc_pf_netdev_setup()
826 struct device *dev = &pf->si->pdev->dev; in enetc_mdio_probe()
842 mdio_priv->hw = &pf->si->hw; in enetc_mdio_probe()
863 struct device *dev = &pf->si->pdev->dev; in enetc_imdio_create()
881 mdio_priv->hw = &pf->si->hw; in enetc_imdio_create()
972 enetc_mac_config(pf->si, state->interface); in enetc_pl_mac_config()
975 static void enetc_force_rgmii_mac(struct enetc_si *si, int speed, int duplex) in enetc_force_rgmii_mac() argument
979 old_val = val = enetc_port_mac_rd(si, ENETC_PM0_IF_MODE); in enetc_force_rgmii_mac()
1000 enetc_port_mac_wr(si, ENETC_PM0_IF_MODE, val); in enetc_force_rgmii_mac()
1011 struct enetc_hw *hw = &pf->si->hw; in enetc_pl_mac_link_up()
1012 struct enetc_si *si = pf->si; in enetc_pl_mac_link_up() local
1017 priv = netdev_priv(pf->si->ndev); in enetc_pl_mac_link_up()
1019 if (pf->si->hw_features & ENETC_SI_F_QBV) in enetc_pl_mac_link_up()
1024 enetc_force_rgmii_mac(si, speed, duplex); in enetc_pl_mac_link_up()
1060 enetc_port_mac_wr(si, ENETC_PM0_PAUSE_QUANTA, init_quanta); in enetc_pl_mac_link_up()
1061 enetc_port_mac_wr(si, ENETC_PM0_PAUSE_THRESH, refresh_quanta); in enetc_pl_mac_link_up()
1065 cmd_cfg = enetc_port_mac_rd(si, ENETC_PM0_CMD_CFG); in enetc_pl_mac_link_up()
1072 enetc_port_mac_wr(si, ENETC_PM0_CMD_CFG, cmd_cfg); in enetc_pl_mac_link_up()
1074 enetc_mac_enable(si, true); in enetc_pl_mac_link_up()
1076 if (si->hw_features & ENETC_SI_F_QBU) in enetc_pl_mac_link_up()
1085 struct enetc_si *si = pf->si; in enetc_pl_mac_link_down() local
1088 priv = netdev_priv(si->ndev); in enetc_pl_mac_link_down()
1090 if (si->hw_features & ENETC_SI_F_QBU) in enetc_pl_mac_link_down()
1093 enetc_mac_enable(si, false); in enetc_pl_mac_link_down()
1106 struct enetc_pf *pf = enetc_si_priv(priv->si); in enetc_phylink_create()
1145 static int enetc_init_port_rfs_memory(struct enetc_si *si) in enetc_init_port_rfs_memory() argument
1148 struct enetc_hw *hw = &si->hw; in enetc_init_port_rfs_memory()
1156 err = enetc_set_fs_entry(si, &rfse, i); in enetc_init_port_rfs_memory()
1164 static int enetc_init_port_rss_memory(struct enetc_si *si) in enetc_init_port_rss_memory() argument
1166 struct enetc_hw *hw = &si->hw; in enetc_init_port_rss_memory()
1180 err = enetc_set_rss_table(si, rss_table, num_rss); in enetc_init_port_rss_memory()
1208 struct enetc_si *si; in enetc_psi_create() local
1217 si = pci_get_drvdata(pdev); in enetc_psi_create()
1218 if (!si->hw.port || !si->hw.global) { in enetc_psi_create()
1224 err = enetc_setup_cbdr(&pdev->dev, &si->hw, ENETC_CBDR_DEFAULT_SIZE, in enetc_psi_create()
1225 &si->cbd_ring); in enetc_psi_create()
1229 err = enetc_init_port_rfs_memory(si); in enetc_psi_create()
1235 err = enetc_init_port_rss_memory(si); in enetc_psi_create()
1241 return si; in enetc_psi_create()
1244 enetc_teardown_cbdr(&si->cbd_ring); in enetc_psi_create()
1253 struct enetc_si *si = pci_get_drvdata(pdev); in enetc_psi_destroy() local
1255 enetc_teardown_cbdr(&si->cbd_ring); in enetc_psi_destroy()
1265 struct enetc_si *si; in enetc_pf_probe() local
1277 si = enetc_psi_create(pdev); in enetc_pf_probe()
1278 if (IS_ERR(si)) { in enetc_pf_probe()
1279 err = PTR_ERR(si); in enetc_pf_probe()
1283 pf = enetc_si_priv(si); in enetc_pf_probe()
1284 pf->si = si; in enetc_pf_probe()
1293 enetc_get_si_caps(si); in enetc_pf_probe()
1302 enetc_pf_netdev_setup(si, ndev, &enetc_ndev_ops); in enetc_pf_probe()
1359 si->ndev = NULL; in enetc_pf_probe()
1370 struct enetc_si *si = pci_get_drvdata(pdev); in enetc_pf_remove() local
1371 struct enetc_pf *pf = enetc_si_priv(si); in enetc_pf_remove()
1374 priv = netdev_priv(si->ndev); in enetc_pf_remove()
1379 unregister_netdev(si->ndev); in enetc_pf_remove()
1388 free_netdev(si->ndev); in enetc_pf_remove()
1396 struct enetc_si *si; in enetc_fixup_clear_rss_rfs() local
1404 si = enetc_psi_create(pdev); in enetc_fixup_clear_rss_rfs()
1405 if (!IS_ERR(si)) in enetc_fixup_clear_rss_rfs()