Lines Matching defs:port

16  * The hardware does not support VLAN filter on the port, but on the
20 * rule and the CPU port is also added to all bridges. This makes it possible
23 * each switch port which is used when the port is used without an
169 #define GSWIP_PCE_PMAP1 0x453 /* Monitoring port map */
170 #define GSWIP_PCE_PMAP2 0x454 /* Default Multicast port map */
171 #define GSWIP_PCE_PMAP3 0x455 /* Default Unknown Unicast port map */
425 int port)
427 /* There's no MII_CFG register for the CPU port */
428 if (!dsa_is_cpu_port(priv->ds, port))
429 gswip_mii_mask(priv, clear, set, GSWIP_MII_CFGp(port));
433 int port)
435 switch (port) {
639 /* Add the LAN port into a bridge with the CPU port by
644 static int gswip_add_single_port_br(struct gswip_priv *priv, int port, bool add)
652 if (port >= max_ports) {
653 dev_err(priv->dev, "single port for %i supported\n", port);
657 vlan_active.index = port + 1;
660 vlan_active.val[0] = port + 1 /* fid */;
671 vlan_mapping.index = port + 1;
674 vlan_mapping.val[1] = BIT(port) | BIT(cpu_port);
685 static int gswip_port_enable(struct dsa_switch *ds, int port,
691 if (!dsa_is_user_port(ds, port))
694 if (!dsa_is_cpu_port(ds, port)) {
695 err = gswip_add_single_port_br(priv, port, true);
700 /* RMON Counter Enable for port */
701 gswip_switch_w(priv, GSWIP_BM_PCFG_CNTEN, GSWIP_BM_PCFGp(port));
703 /* enable port fetch/store dma & VLAN Modification */
706 GSWIP_FDMA_PCTRLp(port));
708 GSWIP_SDMA_PCTRLp(port));
710 if (!dsa_is_cpu_port(ds, port)) {
717 GSWIP_MDIO_PHYp(port));
723 static void gswip_port_disable(struct dsa_switch *ds, int port)
727 if (!dsa_is_user_port(ds, port))
731 GSWIP_FDMA_PCTRLp(port));
733 GSWIP_SDMA_PCTRLp(port));
773 static int gswip_port_vlan_filtering(struct dsa_switch *ds, int port,
777 struct net_device *bridge = dsa_port_bridge_dev_get(dsa_to_port(ds, port));
781 if (bridge && !!(priv->port_vlan_filter & BIT(port)) != vlan_filtering) {
788 /* Use port based VLAN tag */
793 GSWIP_PCE_VCTRL(port));
795 GSWIP_PCE_PCTRL_0p(port));
797 /* Use port based VLAN tag */
802 GSWIP_PCE_VCTRL(port));
804 GSWIP_PCE_PCTRL_0p(port));
821 /* disable port fetch/store dma on all ports */
836 /* Default unknown Broadcast/Multicast/Unicast port maps */
848 * to the switch port being completely dead (RX and TX are both not
850 * Also with various other PHY / port combinations (PHY11G GPHY, PHY22F
868 /* enable special tag insertion on cpu port */
902 int port,
968 struct net_device *bridge, int port)
1013 vlan_mapping.val[1] |= BIT(port);
1023 gswip_switch_w(priv, 0, GSWIP_PCE_DEFPVID(port));
1028 struct net_device *bridge, int port,
1083 vlan_mapping.val[1] |= BIT(port);
1085 vlan_mapping.val[2] &= ~BIT(port);
1087 vlan_mapping.val[2] |= BIT(port);
1098 gswip_switch_w(priv, idx, GSWIP_PCE_DEFPVID(port));
1104 struct net_device *bridge, int port,
1136 vlan_mapping.val[1] &= ~BIT(port);
1137 vlan_mapping.val[2] &= ~BIT(port);
1156 gswip_switch_w(priv, 0, GSWIP_PCE_DEFPVID(port));
1161 static int gswip_port_bridge_join(struct dsa_switch *ds, int port,
1174 err = gswip_vlan_add_unaware(priv, br, port);
1177 priv->port_vlan_filter &= ~BIT(port);
1179 priv->port_vlan_filter |= BIT(port);
1181 return gswip_add_single_port_br(priv, port, false);
1184 static void gswip_port_bridge_leave(struct dsa_switch *ds, int port,
1190 gswip_add_single_port_br(priv, port, true);
1196 gswip_vlan_remove(priv, br, port, 0, true, false);
1199 static int gswip_port_vlan_prepare(struct dsa_switch *ds, int port,
1203 struct net_device *bridge = dsa_port_bridge_dev_get(dsa_to_port(ds, port));
1210 if (!dsa_is_cpu_port(ds, port) && !bridge)
1245 static int gswip_port_vlan_add(struct dsa_switch *ds, int port,
1249 struct net_device *bridge = dsa_port_bridge_dev_get(dsa_to_port(ds, port));
1255 err = gswip_port_vlan_prepare(ds, port, vlan, extack);
1259 /* We have to receive all packets on the CPU port and should not
1264 if (dsa_is_cpu_port(ds, port))
1267 return gswip_vlan_add_aware(priv, bridge, port, vlan->vid,
1271 static int gswip_port_vlan_del(struct dsa_switch *ds, int port,
1274 struct net_device *bridge = dsa_port_bridge_dev_get(dsa_to_port(ds, port));
1278 /* We have to receive all packets on the CPU port and should not
1283 if (dsa_is_cpu_port(ds, port))
1286 return gswip_vlan_remove(priv, bridge, port, vlan->vid, pvid, true);
1289 static void gswip_port_fast_age(struct dsa_switch *ds, int port)
1313 if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) != port)
1326 static void gswip_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
1334 GSWIP_SDMA_PCTRLp(port));
1352 GSWIP_SDMA_PCTRLp(port));
1354 GSWIP_PCE_PCTRL_0p(port));
1357 static int gswip_port_fdb(struct dsa_switch *ds, int port,
1360 struct net_device *bridge = dsa_port_bridge_dev_get(dsa_to_port(ds, port));
1389 mac_bridge.val[0] = add ? BIT(port) : 0; /* port map */
1400 static int gswip_port_fdb_add(struct dsa_switch *ds, int port,
1404 return gswip_port_fdb(ds, port, addr, vid, true);
1407 static int gswip_port_fdb_del(struct dsa_switch *ds, int port,
1411 return gswip_port_fdb(ds, port, addr, vid, false);
1414 static int gswip_port_fdb_dump(struct dsa_switch *ds, int port,
1445 if (mac_bridge.val[0] & BIT(port)) {
1451 if (((mac_bridge.val[0] & GENMASK(7, 4)) >> 4) == port) {
1461 static int gswip_port_max_mtu(struct dsa_switch *ds, int port)
1467 static int gswip_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
1472 /* CPU port always has maximum mtu of user ports, so use it to set
1475 if (port == cpu_port) {
1482 * header on the CPU port added above.
1486 GSWIP_MAC_CTRL_2p(port));
1489 GSWIP_MAC_CTRL_2p(port));
1494 static void gswip_xrx200_phylink_get_caps(struct dsa_switch *ds, int port,
1497 switch (port) {
1527 static void gswip_xrx300_phylink_get_caps(struct dsa_switch *ds, int port,
1530 switch (port) {
1560 static void gswip_port_set_link(struct gswip_priv *priv, int port, bool link)
1570 GSWIP_MDIO_PHYp(port));
1573 static void gswip_port_set_speed(struct gswip_priv *priv, int port, int speed,
1611 GSWIP_MDIO_PHYp(port));
1612 gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_RATE_MASK, mii_cfg, port);
1614 GSWIP_MAC_CTRL_0p(port));
1617 static void gswip_port_set_duplex(struct gswip_priv *priv, int port, int duplex)
1630 GSWIP_MAC_CTRL_0p(port));
1632 GSWIP_MDIO_PHYp(port));
1635 static void gswip_port_set_pause(struct gswip_priv *priv, int port,
1659 mac_ctrl_0, GSWIP_MAC_CTRL_0p(port));
1663 mdio_phy, GSWIP_MDIO_PHYp(port));
1666 static void gswip_phylink_mac_config(struct dsa_switch *ds, int port,
1704 miicfg, port);
1709 GSWIP_MII_PCDU_RXDLY_MASK, 0, port);
1712 gswip_mii_mask_pcdu(priv, GSWIP_MII_PCDU_RXDLY_MASK, 0, port);
1715 gswip_mii_mask_pcdu(priv, GSWIP_MII_PCDU_TXDLY_MASK, 0, port);
1722 static void gswip_phylink_mac_link_down(struct dsa_switch *ds, int port,
1728 gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, port);
1730 if (!dsa_is_cpu_port(ds, port))
1731 gswip_port_set_link(priv, port, false);
1734 static void gswip_phylink_mac_link_up(struct dsa_switch *ds, int port,
1743 if (!dsa_is_cpu_port(ds, port)) {
1744 gswip_port_set_link(priv, port, true);
1745 gswip_port_set_speed(priv, port, speed, interface);
1746 gswip_port_set_duplex(priv, port, duplex);
1747 gswip_port_set_pause(priv, port, tx_pause, rx_pause);
1750 gswip_mii_mask_cfg(priv, 0, GSWIP_MII_CFG_EN, port);
1753 static void gswip_get_strings(struct dsa_switch *ds, int port, u32 stringset,
1792 static void gswip_get_ethtool_stats(struct dsa_switch *ds, int port,
1803 data[i] = gswip_bcm_ram_entry_read(priv, port,
1806 high = gswip_bcm_ram_entry_read(priv, port,
1813 static int gswip_get_sset_count(struct dsa_switch *ds, int port, int sset)
2182 dev_err(dev, "wrong CPU port defined, HW only supports port: %i",