Lines Matching refs:port
165 int port)
173 if (port >= 0) {
175 reg |= FIELD_PREP(QCA8K_ATU_FUNC_PORT_MASK, port);
201 int port)
206 ret = qca8k_fdb_access(priv, QCA8K_FDB_NEXT, port);
272 /* Add port to fdb portmask */
310 /* Only port in the rule is this port. Don't re insert */
314 /* Remove port from port mask */
358 static int qca8k_vlan_add(struct qca8k_priv *priv, u8 port, u16 vid,
379 reg &= ~QCA8K_VTU_FUNC0_EG_MODE_PORT_MASK(port);
381 reg |= QCA8K_VTU_FUNC0_EG_MODE_PORT_UNTAG(port);
383 reg |= QCA8K_VTU_FUNC0_EG_MODE_PORT_TAG(port);
396 static int qca8k_vlan_del(struct qca8k_priv *priv, u8 port, u16 vid)
410 reg &= ~QCA8K_VTU_FUNC0_EG_MODE_PORT_MASK(port);
411 reg |= QCA8K_VTU_FUNC0_EG_MODE_PORT_NOT(port);
466 void qca8k_port_set_status(struct qca8k_priv *priv, int port, int enable)
471 if (port > 0 && port < 6)
475 regmap_set_bits(priv->regmap, QCA8K_REG_PORT_STATUS(port), mask);
477 regmap_clear_bits(priv->regmap, QCA8K_REG_PORT_STATUS(port), mask);
480 void qca8k_get_strings(struct dsa_switch *ds, int port, u32 stringset,
494 void qca8k_get_ethtool_stats(struct dsa_switch *ds, int port,
504 priv->info->ops->autocast_mib(ds, port, data) > 0)
509 reg = QCA8K_PORT_MIB_COUNTER(port) + mib->offset;
527 int qca8k_get_sset_count(struct dsa_switch *ds, int port, int sset)
537 int qca8k_set_mac_eee(struct dsa_switch *ds, int port,
540 u32 lpi_en = QCA8K_REG_EEE_CTRL_LPI_EN(port);
561 int qca8k_get_mac_eee(struct dsa_switch *ds, int port,
564 /* Nothing to do on the port's MAC */
568 static int qca8k_port_configure_learning(struct dsa_switch *ds, int port,
575 QCA8K_PORT_LOOKUP_CTRL(port),
579 QCA8K_PORT_LOOKUP_CTRL(port),
583 void qca8k_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
585 struct dsa_port *dp = dsa_to_port(ds, port);
612 qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
615 qca8k_port_configure_learning(ds, port, learning);
618 int qca8k_port_pre_bridge_flags(struct dsa_switch *ds, int port,
628 int qca8k_port_bridge_flags(struct dsa_switch *ds, int port,
635 ret = qca8k_port_configure_learning(ds, port,
644 int qca8k_port_bridge_join(struct dsa_switch *ds, int port,
653 cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
661 /* Add this port to the portvlan mask of the other ports
666 BIT(port));
669 if (i != port)
674 ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
680 void qca8k_port_bridge_leave(struct dsa_switch *ds, int port,
686 cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
693 /* Remove this port to the portvlan mask of the other ports
698 BIT(port));
701 /* Set the cpu port to be the only one in the portvlan mask of
702 * this port
704 qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
708 void qca8k_port_fast_age(struct dsa_switch *ds, int port)
713 qca8k_fdb_access(priv, QCA8K_FDB_FLUSH_PORT, port);
737 int qca8k_port_enable(struct dsa_switch *ds, int port,
742 qca8k_port_set_status(priv, port, 1);
743 priv->port_enabled_map |= BIT(port);
745 if (dsa_is_user_port(ds, port))
751 void qca8k_port_disable(struct dsa_switch *ds, int port)
755 qca8k_port_set_status(priv, port, 0);
756 priv->port_enabled_map &= ~BIT(port);
759 int qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
765 * DSA always set the CPU port's MTU to the largest MTU of the slave
767 * Setting MTU just for the CPU port is sufficient to correctly set a
768 * value for every port.
770 if (!dsa_is_cpu_port(ds, port))
797 int qca8k_port_max_mtu(struct dsa_switch *ds, int port)
805 /* Set the vid to the port vlan id if no vid is set */
813 int qca8k_port_fdb_add(struct dsa_switch *ds, int port,
818 u16 port_mask = BIT(port);
823 int qca8k_port_fdb_del(struct dsa_switch *ds, int port,
828 u16 port_mask = BIT(port);
836 int qca8k_port_fdb_dump(struct dsa_switch *ds, int port,
846 while (cnt-- && !qca8k_fdb_next(priv, &_fdb, port)) {
859 int qca8k_port_mdb_add(struct dsa_switch *ds, int port,
870 return qca8k_fdb_search_and_insert(priv, BIT(port), addr, vid,
874 int qca8k_port_mdb_del(struct dsa_switch *ds, int port,
885 return qca8k_fdb_search_and_del(priv, BIT(port), addr, vid);
888 int qca8k_port_mirror_add(struct dsa_switch *ds, int port,
897 if ((ingress ? priv->mirror_rx : priv->mirror_tx) & BIT(port))
904 /* QCA83xx can have only one port set to mirror mode.
905 * Check that the correct port is requested and return error otherwise.
906 * When no mirror port is set, the values is set to 0xF
912 /* Set the monitor port */
921 reg = QCA8K_PORT_LOOKUP_CTRL(port);
924 reg = QCA8K_REG_PORT_HOL_CTRL1(port);
932 /* Track mirror port for tx and rx to decide when the
933 * mirror port has to be disabled.
936 priv->mirror_rx |= BIT(port);
938 priv->mirror_tx |= BIT(port);
943 void qca8k_port_mirror_del(struct dsa_switch *ds, int port,
951 reg = QCA8K_PORT_LOOKUP_CTRL(port);
954 reg = QCA8K_REG_PORT_HOL_CTRL1(port);
963 priv->mirror_rx &= ~BIT(port);
965 priv->mirror_tx &= ~BIT(port);
967 /* No port set to send packet to mirror port. Disable mirror port */
976 dev_err(priv->dev, "Failed to del mirror port from %d", port);
979 int qca8k_port_vlan_filtering(struct dsa_switch *ds, int port,
987 ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
991 ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
999 int qca8k_port_vlan_add(struct dsa_switch *ds, int port,
1008 ret = qca8k_vlan_add(priv, port, vlan->vid, untagged);
1010 dev_err(priv->dev, "Failed to add VLAN to port %d (%d)", port, ret);
1015 ret = qca8k_rmw(priv, QCA8K_EGRESS_VLAN(port),
1016 QCA8K_EGREES_VLAN_PORT_MASK(port),
1017 QCA8K_EGREES_VLAN_PORT(port, vlan->vid));
1021 ret = qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(port),
1029 int qca8k_port_vlan_del(struct dsa_switch *ds, int port,
1035 ret = qca8k_vlan_del(priv, port, vlan->vid);
1037 dev_err(priv->dev, "Failed to delete VLAN from port %d (%d)", port, ret);
1054 /* Includes the port joining the LAG */
1127 static int qca8k_lag_refresh_portmap(struct dsa_switch *ds, int port,
1137 /* Read current port member */
1146 val &= ~BIT(port);
1148 val |= BIT(port);
1150 /* Update port member. With empty portmap disable trunk */
1157 /* Search empty member if adding or port on deleting */
1167 /* If port flagged to be disabled assume this member is
1174 if (val != port)
1177 /* If port flagged to be enabled assume this member is
1188 /* Set port in the correct port mask or disable port if in delete mode */
1193 port << QCA8K_REG_GOL_TRUNK_ID_MEM_ID_SHIFT(id, i));
1196 int qca8k_port_lag_join(struct dsa_switch *ds, int port, struct dsa_lag lag,
1209 return qca8k_lag_refresh_portmap(ds, port, lag, false);
1212 int qca8k_port_lag_leave(struct dsa_switch *ds, int port,
1215 return qca8k_lag_refresh_portmap(ds, port, lag, true);