/* Port Group IDs (PGID) are masks of destination ports. * * For L2 forwarding, the switch performs 3 lookups in the PGID table for each * frame, and forwards the frame to the ports that are present in the logical * AND of all 3 PGIDs. * * These PGID lookups are: * - In one of PGID[0-63]: for the destination masks. There are 2 paths by * which the switch selects a destination PGID: * - The {DMAC, VID} is present in the MAC table. In that case, the * destination PGID is given by the DEST_IDX field of the MAC table entry * that matched. * - The {DMAC, VID} is not present in the MAC table (it is unknown). The * frame is disseminated as being either unicast, multicast or broadcast, * and according to that, the destination PGID is chosen as being the * value contained by ANA_FLOODING_FLD_UNICAST, * ANA_FLOODING_FLD_MULTICAST or ANA_FLOODING_FLD_BROADCAST. * The destination PGID can be an unicast set: the first PGIDs, 0 to * ocelot->num_phys_ports - 1, or a multicast set: the PGIDs from * ocelot->num_phys_ports to 63. By convention, a unicast PGID corresponds to * a physical port and has a single bit set in the destination ports mask: * that corresponding to the port number itself. In contrast, a multicast * PGID will have potentially more than one single bit set in the destination * ports mask. * - In one of PGID[64-79]: for the aggregation mask. The switch classifier * dissects each frame and generates a 4-bit Link Aggregation Code which is * used for this second PGID table lookup. The goal of link aggregation is to * hash multiple flows within the same LAG on to different destination ports. * The first lookup will result in a PGID with all the LAG members present in * the destination ports mask, and the second lookup, by Link Aggregation * Code, will ensure that each flow gets forwarded only to a single port out * of that mask (there are no duplicates). * - In one of PGID[80-90]: for the source mask. The third time, the PGID table * is indexed with the ingress port (plus 80). These PGIDs answer the * question "is port i allowed to forward traffic to port j?" If yes, then * BIT(j) of PGID 80+i will be found set. The third PGID lookup can be used * to enforce the L2 forwarding matrix imposed by e.g. a Linux bridge.
*/
/* Reserve some destination PGIDs at the end of the range: * PGID_BLACKHOLE: used for not forwarding the frames * PGID_CPU: used for whitelisting certain MAC addresses, such as the addresses * of the switch port net devices, towards the CPU port module. * PGID_UC: the flooding destinations for unknown unicast traffic. * PGID_MC: the flooding destinations for non-IP multicast traffic. * PGID_MCIPV4: the flooding destinations for IPv4 multicast traffic. * PGID_MCIPV6: the flooding destinations for IPv6 multicast traffic. * PGID_BC: the flooding destinations for broadcast traffic.
*/ #define PGID_BLACKHOLE 57 #define PGID_CPU 58 #define PGID_UC 59 #define PGID_MC 60 #define PGID_MCIPV4 61 #define PGID_MCIPV6 62 #define PGID_BC 63
enum ocelot_port_tag_config { /* all VLANs are egress-untagged */
OCELOT_PORT_TAG_DISABLED = 0, /* all VLANs except the native VLAN and VID 0 are egress-tagged */
OCELOT_PORT_TAG_NATIVE = 1, /* all VLANs except VID 0 are egress-tagged */
OCELOT_PORT_TAG_TRUNK_NO_VID0 = 2, /* all VLANs are egress-tagged */
OCELOT_PORT_TAG_TRUNK = 3,
};
/* MAC table entry types. * ENTRYTYPE_NORMAL is subject to aging. * ENTRYTYPE_LOCKED is not subject to aging. * ENTRYTYPE_MACv4 is not subject to aging. For IPv4 multicast. * ENTRYTYPE_MACv6 is not subject to aging. For IPv6 multicast.
*/ enum macaccess_entry_type {
ENTRYTYPE_NORMAL = 0,
ENTRYTYPE_LOCKED,
ENTRYTYPE_MACv4,
ENTRYTYPE_MACv6,
};
/* Switches like VSC9959 have flooding per traffic class */ int num_flooding_pgids;
/* In tables like ANA:PORT and the ANA:PGID:PGID mask, * the CPU is located after the physical ports (at the * num_phys_ports index).
*/
u8 num_phys_ports;
/* Workqueue to check statistics for overflow */ struct delayed_work stats_work; struct workqueue_struct *stats_queue; /* Lock for serializing access to the statistics array */
spinlock_t stats_lock;
u64 *stats;
/* Lock for serializing indirect access to STAT_VIEW registers */ struct mutex stat_view_lock; /* Lock for serializing access to the MAC table */ struct mutex mact_lock; /* Lock for serializing forwarding domain changes, including the * configuration of the Time-Aware Shaper, MAC Merge layer and * cut-through forwarding, on which it depends
*/ struct mutex fwd_domain_lock;
/* DSA callbacks */ void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data); void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data); int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset); void ocelot_port_get_stats64(struct ocelot *ocelot, int port, struct rtnl_link_stats64 *stats); void ocelot_port_get_pause_stats(struct ocelot *ocelot, int port, struct ethtool_pause_stats *pause_stats); void ocelot_port_get_mm_stats(struct ocelot *ocelot, int port, struct ethtool_mm_stats *stats); void ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port, struct ethtool_rmon_stats *rmon_stats, conststruct ethtool_rmon_hist_range **ranges); void ocelot_port_get_eth_ctrl_stats(struct ocelot *ocelot, int port, struct ethtool_eth_ctrl_stats *ctrl_stats); void ocelot_port_get_eth_mac_stats(struct ocelot *ocelot, int port, struct ethtool_eth_mac_stats *mac_stats); void ocelot_port_get_eth_phy_stats(struct ocelot *ocelot, int port, struct ethtool_eth_phy_stats *phy_stats); void ocelot_port_get_ts_stats(struct ocelot *ocelot, int port, struct ethtool_ts_stats *ts_stats); int ocelot_get_ts_info(struct ocelot *ocelot, int port, struct kernel_ethtool_ts_info *info); void ocelot_set_ageing_time(struct ocelot *ocelot, unsignedint msecs); int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled, struct netlink_ext_ack *extack); void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port); int ocelot_port_pre_bridge_flags(struct ocelot *ocelot, int port, struct switchdev_brport_flags val); void ocelot_port_bridge_flags(struct ocelot *ocelot, int port, struct switchdev_brport_flags val); int ocelot_port_get_default_prio(struct ocelot *ocelot, int port); int ocelot_port_set_default_prio(struct ocelot *ocelot, int port, u8 prio); int ocelot_port_get_dscp_prio(struct ocelot *ocelot, int port, u8 dscp); int ocelot_port_add_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio); int ocelot_port_del_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio); int ocelot_port_bridge_join(struct ocelot *ocelot, int port, struct net_device *bridge, int bridge_num, struct netlink_ext_ack *extack); void ocelot_port_bridge_leave(struct ocelot *ocelot, int port, struct net_device *bridge); int ocelot_mact_flush(struct ocelot *ocelot, int port); int ocelot_fdb_dump(struct ocelot *ocelot, int port,
dsa_fdb_dump_cb_t *cb, void *data); int ocelot_fdb_add(struct ocelot *ocelot, int port, constunsignedchar *addr,
u16 vid, conststruct net_device *bridge); int ocelot_fdb_del(struct ocelot *ocelot, int port, constunsignedchar *addr,
u16 vid, conststruct net_device *bridge); int ocelot_lag_fdb_add(struct ocelot *ocelot, struct net_device *bond, constunsignedchar *addr, u16 vid, conststruct net_device *bridge); int ocelot_lag_fdb_del(struct ocelot *ocelot, struct net_device *bond, constunsignedchar *addr, u16 vid, conststruct net_device *bridge); int ocelot_vlan_prepare(struct ocelot *ocelot, int port, u16 vid, bool pvid, bool untagged, struct netlink_ext_ack *extack); int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid, bool untagged); int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid); void ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct kernel_hwtstamp_config *cfg); int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct kernel_hwtstamp_config *cfg, struct netlink_ext_ack *extack); int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port, struct sk_buff *skb, struct sk_buff **clone); void ocelot_get_txtstamp(struct ocelot *ocelot); void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu); int ocelot_get_max_mtu(struct ocelot *ocelot, int port); int ocelot_port_policer_add(struct ocelot *ocelot, int port, struct ocelot_policer *pol); int ocelot_port_policer_del(struct ocelot *ocelot, int port); int ocelot_port_mirror_add(struct ocelot *ocelot, int from, int to, bool ingress, struct netlink_ext_ack *extack); void ocelot_port_mirror_del(struct ocelot *ocelot, int from, bool ingress); int ocelot_cls_flower_replace(struct ocelot *ocelot, int port, struct flow_cls_offload *f, bool ingress); int ocelot_cls_flower_destroy(struct ocelot *ocelot, int port, struct flow_cls_offload *f, bool ingress); int ocelot_cls_flower_stats(struct ocelot *ocelot, int port, struct flow_cls_offload *f, bool ingress); int ocelot_port_mdb_add(struct ocelot *ocelot, int port, conststruct switchdev_obj_port_mdb *mdb, conststruct net_device *bridge); int ocelot_port_mdb_del(struct ocelot *ocelot, int port, conststruct switchdev_obj_port_mdb *mdb, conststruct net_device *bridge); int ocelot_port_lag_join(struct ocelot *ocelot, int port, struct net_device *bond, struct netdev_lag_upper_info *info, struct netlink_ext_ack *extack); void ocelot_port_lag_leave(struct ocelot *ocelot, int port, struct net_device *bond); void ocelot_port_lag_change(struct ocelot *ocelot, int port, bool lag_tx_active); int ocelot_bond_get_id(struct ocelot *ocelot, struct net_device *bond);
int ocelot_devlink_sb_register(struct ocelot *ocelot); void ocelot_devlink_sb_unregister(struct ocelot *ocelot); int ocelot_sb_pool_get(struct ocelot *ocelot, unsignedint sb_index,
u16 pool_index, struct devlink_sb_pool_info *pool_info); int ocelot_sb_pool_set(struct ocelot *ocelot, unsignedint sb_index,
u16 pool_index, u32 size, enum devlink_sb_threshold_type threshold_type, struct netlink_ext_ack *extack); int ocelot_sb_port_pool_get(struct ocelot *ocelot, int port, unsignedint sb_index, u16 pool_index,
u32 *p_threshold); int ocelot_sb_port_pool_set(struct ocelot *ocelot, int port, unsignedint sb_index, u16 pool_index,
u32 threshold, struct netlink_ext_ack *extack); int ocelot_sb_tc_pool_bind_get(struct ocelot *ocelot, int port, unsignedint sb_index, u16 tc_index, enum devlink_sb_pool_type pool_type,
u16 *p_pool_index, u32 *p_threshold); int ocelot_sb_tc_pool_bind_set(struct ocelot *ocelot, int port, unsignedint sb_index, u16 tc_index, enum devlink_sb_pool_type pool_type,
u16 pool_index, u32 threshold, struct netlink_ext_ack *extack); int ocelot_sb_occ_snapshot(struct ocelot *ocelot, unsignedint sb_index); int ocelot_sb_occ_max_clear(struct ocelot *ocelot, unsignedint sb_index); int ocelot_sb_occ_port_pool_get(struct ocelot *ocelot, int port, unsignedint sb_index, u16 pool_index,
u32 *p_cur, u32 *p_max); int ocelot_sb_occ_tc_port_bind_get(struct ocelot *ocelot, int port, unsignedint sb_index, u16 tc_index, enum devlink_sb_pool_type pool_type,
u32 *p_cur, u32 *p_max);
int ocelot_port_configure_serdes(struct ocelot *ocelot, int port, struct device_node *portnp);
void ocelot_phylink_mac_config(struct ocelot *ocelot, int port, unsignedint link_an_mode, conststruct phylink_link_state *state); void ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port, unsignedint link_an_mode,
phy_interface_t interface, unsignedlong quirks); void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port, struct phy_device *phydev, unsignedint link_an_mode,
phy_interface_t interface, int speed, int duplex, bool tx_pause, bool rx_pause, unsignedlong quirks);
int ocelot_mact_lookup(struct ocelot *ocelot, int *dst_idx, constunsignedchar mac[ETH_ALEN], unsignedint vid, enum macaccess_entry_type *type); int ocelot_mact_learn_streamdata(struct ocelot *ocelot, int dst_idx, constunsignedchar mac[ETH_ALEN], unsignedint vid, enum macaccess_entry_type type, int sfid, int ssid);
int ocelot_migrate_mdbs(struct ocelot *ocelot, unsignedlong from_mask, unsignedlong to_mask);
int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix, struct ocelot_policer *pol); int ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix);
void ocelot_mm_irq(struct ocelot *ocelot); int ocelot_port_set_mm(struct ocelot *ocelot, int port, struct ethtool_mm_cfg *cfg, struct netlink_ext_ack *extack); int ocelot_port_get_mm(struct ocelot *ocelot, int port, struct ethtool_mm_state *state); int ocelot_port_mqprio(struct ocelot *ocelot, int port, struct tc_mqprio_qopt_offload *mqprio);
#if IS_ENABLED(CONFIG_BRIDGE_MRP) int ocelot_mrp_add(struct ocelot *ocelot, int port, conststruct switchdev_obj_mrp *mrp); int ocelot_mrp_del(struct ocelot *ocelot, int port, conststruct switchdev_obj_mrp *mrp); int ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port, conststruct switchdev_obj_ring_role_mrp *mrp); int ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port, conststruct switchdev_obj_ring_role_mrp *mrp); #else staticinlineint ocelot_mrp_add(struct ocelot *ocelot, int port, conststruct switchdev_obj_mrp *mrp)
{ return -EOPNOTSUPP;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.