diff options
author | Xiaoliang Yang <xiaoliang.yang_1@nxp.com> | 2020-08-31 10:48:10 +0800 |
---|---|---|
committer | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-05-04 15:25:02 +0200 |
commit | c515d87a9a7a7f6d1f43b9479d896c74183e9de8 (patch) | |
tree | fa2e6e99da8b044a588dc8a926bbf883c1421984 /include | |
parent | ac8980cdc7f87df7d378bc04fb33ca2088fb508c (diff) |
net: dsa: felix: add tsn support for felix switch based on net/tsn
VSC9959 has TSN capabilities on hardware. Using tsntool netlink
interface to configure the following TSN features:
- IEEE 802.1Qbv
- IEEE 802.1Qbu/802.3br
- IEEE 802.1Qci
- IEEE 802.1Qav
- IEEE 802.1CB
This patch is based on netlink adaptation layer in net/tsn/*.
Enable CONFIG_MSCC_FELIX_SWITCH_TSN config to add the TSN support.
Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/soc/mscc/ocelot.h | 42 | ||||
-rw-r--r-- | include/soc/mscc/ocelot_ana.h | 10 | ||||
-rw-r--r-- | include/soc/mscc/ocelot_dev.h | 23 |
3 files changed, 65 insertions, 10 deletions
diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 8e9c3a085327..19985c4c0749 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -51,6 +51,7 @@ */ /* Reserve some destination PGIDs at the end of the range: + * PGID_FRER: Destinations for multicast traffic in 802.1CB redundant network. * 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. @@ -60,6 +61,7 @@ * PGID_MCIPV6: the flooding destinations for IPv6 multicast traffic. * PGID_BC: the flooding destinations for broadcast traffic. */ +#define PGID_FRER 56 #define PGID_BLACKHOLE 57 #define PGID_CPU 58 #define PGID_UC 59 @@ -75,7 +77,7 @@ #define for_each_nonreserved_multicast_dest_pgid(ocelot, pgid) \ for ((pgid) = (ocelot)->num_phys_ports + 1; \ - (pgid) < PGID_BLACKHOLE; \ + (pgid) < PGID_FRER; \ (pgid)++) #define for_each_aggr_pgid(ocelot, pgid) \ @@ -414,6 +416,9 @@ enum ocelot_reg { DEV_MAC_FC_MAC_LOW_CFG, DEV_MAC_FC_MAC_HIGH_CFG, DEV_MAC_STICKY, + DEV_MM_ENABLE_CONFIG, + DEV_MM_VERIF_CONFIG, + DEV_MM_STATUS, PCS1G_CFG, PCS1G_MODE_CFG, PCS1G_SD_CFG, @@ -632,6 +637,12 @@ enum macaccess_entry_type { ENTRYTYPE_MACv6, }; +struct ocelot_mact_entry { + u8 mac[ETH_ALEN]; + u16 vid; + enum macaccess_entry_type type; +}; + #define OCELOT_QUIRK_PCS_PERFORMS_RATE_ADAPTATION BIT(0) #define OCELOT_QUIRK_QSGMII_PORTS_MUST_BE_UP BIT(1) @@ -671,6 +682,9 @@ struct ocelot_port { int bridge_num; u8 stp_state; + bool force_forward; + u8 cut_thru; + int speed; s64 base_time; @@ -762,6 +776,22 @@ struct ocelot_policer { u32 burst; /* bytes */ }; +int ocelot_mact_read(struct ocelot *ocelot, int row, int col, int *dst, + struct ocelot_mact_entry *entry); +int ocelot_mact_learn(struct ocelot *ocelot, int port, + const unsigned char mac[ETH_ALEN], + unsigned int vid, enum macaccess_entry_type type); +int ocelot_mact_forget(struct ocelot *ocelot, const unsigned char mac[ETH_ALEN], + unsigned int vid); +int ocelot_mact_lookup(struct ocelot *ocelot, int *dst_idx, + const unsigned char mac[ETH_ALEN], + unsigned int vid, enum macaccess_entry_type *type); +int ocelot_mact_learn_streamdata(struct ocelot *ocelot, int dst_idx, + const unsigned char mac[ETH_ALEN], + unsigned int vid, + enum macaccess_entry_type type, + int sfid, int ssid); + #define ocelot_bulk_read_rix(ocelot, reg, ri, buf, count) \ __ocelot_bulk_read_ix(ocelot, reg, reg##_RSZ * (ri), buf, count) @@ -860,6 +890,7 @@ int ocelot_get_ts_info(struct ocelot *ocelot, int port, void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs); int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled, struct netlink_ext_ack *extack); +void ocelot_bridge_force_forward_port(struct ocelot *ocelot, int port, bool en); void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state); u32 ocelot_get_dsa_8021q_cpu_mask(struct ocelot *ocelot); u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port); @@ -967,15 +998,6 @@ void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port, bool tx_pause, bool rx_pause, unsigned long quirks); -int ocelot_mact_lookup(struct ocelot *ocelot, int *dst_idx, - const unsigned char mac[ETH_ALEN], - unsigned int vid, enum macaccess_entry_type *type); -int ocelot_mact_learn_streamdata(struct ocelot *ocelot, int dst_idx, - const unsigned char mac[ETH_ALEN], - unsigned int vid, - enum macaccess_entry_type type, - int sfid, int ssid); - 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); diff --git a/include/soc/mscc/ocelot_ana.h b/include/soc/mscc/ocelot_ana.h index 67e0ae05a5ab..ff2b20e9af08 100644 --- a/include/soc/mscc/ocelot_ana.h +++ b/include/soc/mscc/ocelot_ana.h @@ -138,6 +138,9 @@ #define MACACCESS_CMD_READ 6 #define MACACCESS_CMD_WRITE 7 +#define MACACCESS_ENTRY_TYPE_NORMAL 0 +#define MACACCESS_ENTRY_TYPE_LOCKED 1 + #define ANA_TABLES_VLANACCESS_VLAN_PORT_MASK(x) (((x) << 2) & GENMASK(13, 2)) #define ANA_TABLES_VLANACCESS_VLAN_PORT_MASK_M GENMASK(13, 2) #define ANA_TABLES_VLANACCESS_VLAN_PORT_MASK_X(x) (((x) & GENMASK(13, 2)) >> 2) @@ -271,6 +274,9 @@ #define ANA_SG_GCL_GS_CONFIG_IPS(x) ((x) & GENMASK(3, 0)) #define ANA_SG_GCL_GS_CONFIG_IPS_M GENMASK(3, 0) +#define ANA_SG_GCL_GS_CONFIG_IPV_VALID BIT(3) +#define ANA_SG_GCL_GS_CONFIG_IPV(x) ((x) & GENMASK(2, 0)) +#define ANA_SG_GCL_GS_CONFIG_IPV_M GENMASK(2, 0) #define ANA_SG_GCL_GS_CONFIG_GATE_STATE BIT(4) #define ANA_SG_GCL_TI_CONFIG_RSZ 0x4 @@ -281,6 +287,10 @@ #define ANA_SG_STATUS_REG_3_IPS(x) (((x) << 20) & GENMASK(23, 20)) #define ANA_SG_STATUS_REG_3_IPS_M GENMASK(23, 20) #define ANA_SG_STATUS_REG_3_IPS_X(x) (((x) & GENMASK(23, 20)) >> 20) +#define ANA_SG_STATUS_REG_3_IPV_VALID BIT(23) +#define ANA_SG_STATUS_REG_3_IPV(x) (((x) << 20) & GENMASK(22, 20)) +#define ANA_SG_STATUS_REG_3_IPV_M GENMASK(22, 20) +#define ANA_SG_STATUS_REG_3_IPV_X(x) (((x) & GENMASK(22, 20)) >> 20) #define ANA_SG_STATUS_REG_3_CONFIG_PENDING BIT(24) #define ANA_PORT_VLAN_CFG_GSZ 0x100 diff --git a/include/soc/mscc/ocelot_dev.h b/include/soc/mscc/ocelot_dev.h index 0c6021f02fee..cb1d8f5a62ee 100644 --- a/include/soc/mscc/ocelot_dev.h +++ b/include/soc/mscc/ocelot_dev.h @@ -93,6 +93,29 @@ #define DEV_MAC_STICKY_TX_FRM_LEN_OVR_STICKY BIT(1) #define DEV_MAC_STICKY_TX_ABORT_STICKY BIT(0) +#define DEV_MM_CONFIG_ENABLE_CONFIG_MM_RX_ENA BIT(0) +#define DEV_MM_CONFIG_ENABLE_CONFIG_MM_TX_ENA BIT(4) +#define DEV_MM_CONFIG_ENABLE_CONFIG_KEEP_S_AFTER_D BIT(8) + +#define DEV_MM_CONFIG_VERIF_CONFIG_PRM_VERIFY_DIS BIT(0) +#define DEV_MM_CONFIG_VERIF_CONFIG_PRM_VERIFY_TIME(x) (((x) << 4) & GENMASK(11, 4)) +#define DEV_MM_CONFIG_VERIF_CONFIG_PRM_VERIFY_TIME_M GENMASK(11, 4) +#define DEV_MM_CONFIG_VERIF_CONFIG_PRM_VERIFY_TIME_X(x) (((x) & GENMASK(11, 4)) >> 4) +#define DEV_MM_CONFIG_VERIF_CONFIG_VERIF_TIMER_UNITS(x) (((x) << 12) & GENMASK(13, 12)) +#define DEV_MM_CONFIG_VERIF_CONFIG_VERIF_TIMER_UNITS_M GENMASK(13, 12) +#define DEV_MM_CONFIG_VERIF_CONFIG_VERIF_TIMER_UNITS_X(x) (((x) & GENMASK(13, 12)) >> 12) + +#define DEV_MM_STATISTICS_MM_STATUS_PRMPT_ACTIVE_STATUS BIT(0) +#define DEV_MM_STATISTICS_MM_STATUS_PRMPT_ACTIVE_STICKY BIT(4) +#define DEV_MM_STATISTICS_MM_STATUS_PRMPT_VERIFY_STATE(x) (((x) << 8) & GENMASK(10, 8)) +#define DEV_MM_STATISTICS_MM_STATUS_PRMPT_VERIFY_STATE_M GENMASK(10, 8) +#define DEV_MM_STATISTICS_MM_STATUS_PRMPT_VERIFY_STATE_X(x) (((x) & GENMASK(10, 8)) >> 8) +#define DEV_MM_STATISTICS_MM_STATUS_UNEXP_RX_PFRM_STICKY BIT(12) +#define DEV_MM_STATISTICS_MM_STATUS_UNEXP_TX_PFRM_STICKY BIT(16) +#define DEV_MM_STATISTICS_MM_STATUS_MM_RX_FRAME_STATUS BIT(20) +#define DEV_MM_STATISTICS_MM_STATUS_MM_TX_FRAME_STATUS BIT(24) +#define DEV_MM_STATISTICS_MM_STATUS_MM_TX_PRMPT_STATUS BIT(28) + #define PCS1G_CFG_LINK_STATUS_TYPE BIT(4) #define PCS1G_CFG_AN_LINK_CTRL_ENA BIT(1) #define PCS1G_CFG_PCS_ENA BIT(0) |