ocelot.h (9d4d8572a539ef807e21c196f145aa365fd52f0e) ocelot.h (b80af659699d212cf8cec6593f6551905c4ae86f)
1/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
2/* Copyright (c) 2017 Microsemi Corporation
3 */
4
5#ifndef _SOC_MSCC_OCELOT_H
6#define _SOC_MSCC_OCELOT_H
7
8#include <linux/ptp_clock_kernel.h>

--- 84 unchanged lines hidden (view full) ---

93#define IFH_TAG_TYPE_S 1
94
95#define IFH_REW_OP_NOOP 0x0
96#define IFH_REW_OP_DSCP 0x1
97#define IFH_REW_OP_ONE_STEP_PTP 0x2
98#define IFH_REW_OP_TWO_STEP_PTP 0x3
99#define IFH_REW_OP_ORIGIN_PTP 0x5
100
1/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
2/* Copyright (c) 2017 Microsemi Corporation
3 */
4
5#ifndef _SOC_MSCC_OCELOT_H
6#define _SOC_MSCC_OCELOT_H
7
8#include <linux/ptp_clock_kernel.h>

--- 84 unchanged lines hidden (view full) ---

93#define IFH_TAG_TYPE_S 1
94
95#define IFH_REW_OP_NOOP 0x0
96#define IFH_REW_OP_DSCP 0x1
97#define IFH_REW_OP_ONE_STEP_PTP 0x2
98#define IFH_REW_OP_TWO_STEP_PTP 0x3
99#define IFH_REW_OP_ORIGIN_PTP 0x5
100
101#define OCELOT_NUM_TC 8
101#define OCELOT_TAG_LEN 16
102#define OCELOT_SHORT_PREFIX_LEN 4
103#define OCELOT_LONG_PREFIX_LEN 16
104#define OCELOT_TOTAL_TAG_LEN (OCELOT_SHORT_PREFIX_LEN + OCELOT_TAG_LEN)
105
106#define OCELOT_SPEED_2500 0
107#define OCELOT_SPEED_1000 1
108#define OCELOT_SPEED_100 2

--- 449 unchanged lines hidden (view full) ---

558
559struct ocelot;
560
561struct ocelot_ops {
562 struct net_device *(*port_to_netdev)(struct ocelot *ocelot, int port);
563 int (*netdev_to_port)(struct net_device *dev);
564 int (*reset)(struct ocelot *ocelot);
565 u16 (*wm_enc)(u16 value);
102#define OCELOT_TAG_LEN 16
103#define OCELOT_SHORT_PREFIX_LEN 4
104#define OCELOT_LONG_PREFIX_LEN 16
105#define OCELOT_TOTAL_TAG_LEN (OCELOT_SHORT_PREFIX_LEN + OCELOT_TAG_LEN)
106
107#define OCELOT_SPEED_2500 0
108#define OCELOT_SPEED_1000 1
109#define OCELOT_SPEED_100 2

--- 449 unchanged lines hidden (view full) ---

559
560struct ocelot;
561
562struct ocelot_ops {
563 struct net_device *(*port_to_netdev)(struct ocelot *ocelot, int port);
564 int (*netdev_to_port)(struct net_device *dev);
565 int (*reset)(struct ocelot *ocelot);
566 u16 (*wm_enc)(u16 value);
567 u16 (*wm_dec)(u16 value);
568 void (*wm_stat)(u32 val, u32 *inuse, u32 *maxuse);
566};
567
568struct ocelot_vcap_block {
569 struct list_head rules;
570 int count;
571 int pol_lpr;
572};
573
574struct ocelot_vlan {
575 bool valid;
576 u16 vid;
577};
578
569};
570
571struct ocelot_vcap_block {
572 struct list_head rules;
573 int count;
574 int pol_lpr;
575};
576
577struct ocelot_vlan {
578 bool valid;
579 u16 vid;
580};
581
582enum ocelot_sb {
583 OCELOT_SB_BUF,
584 OCELOT_SB_REF,
585 OCELOT_SB_NUM,
586};
587
588enum ocelot_sb_pool {
589 OCELOT_SB_POOL_ING,
590 OCELOT_SB_POOL_EGR,
591 OCELOT_SB_POOL_NUM,
592};
593
579struct ocelot_port {
580 struct ocelot *ocelot;
581
582 struct regmap *target;
583
584 bool vlan_aware;
585 /* VLAN that untagged frames are classified to, on ingress */
586 struct ocelot_vlan pvid_vlan;
587 /* The VLAN ID that will be transmitted as untagged, on egress */
588 struct ocelot_vlan native_vlan;
589
590 u8 ptp_cmd;
591 struct sk_buff_head tx_skbs;
592 u8 ts_id;
593 spinlock_t ts_id_lock;
594
595 phy_interface_t phy_mode;
596
597 u8 *xmit_template;
594struct ocelot_port {
595 struct ocelot *ocelot;
596
597 struct regmap *target;
598
599 bool vlan_aware;
600 /* VLAN that untagged frames are classified to, on ingress */
601 struct ocelot_vlan pvid_vlan;
602 /* The VLAN ID that will be transmitted as untagged, on egress */
603 struct ocelot_vlan native_vlan;
604
605 u8 ptp_cmd;
606 struct sk_buff_head tx_skbs;
607 u8 ts_id;
608 spinlock_t ts_id_lock;
609
610 phy_interface_t phy_mode;
611
612 u8 *xmit_template;
613 bool is_dsa_8021q_cpu;
614
615 struct net_device *bond;
598};
599
600struct ocelot {
601 struct device *dev;
616};
617
618struct ocelot {
619 struct device *dev;
620 struct devlink *devlink;
621 struct devlink_port *devlink_ports;
602
603 const struct ocelot_ops *ops;
604 struct regmap *targets[TARGET_MAX];
605 struct regmap_field *regfields[REGFIELD_MAX];
606 const u32 *const *map;
607 const struct ocelot_stat_layout *stats_layout;
608 unsigned int num_stats;
609
622
623 const struct ocelot_ops *ops;
624 struct regmap *targets[TARGET_MAX];
625 struct regmap_field *regfields[REGFIELD_MAX];
626 const u32 *const *map;
627 const struct ocelot_stat_layout *stats_layout;
628 unsigned int num_stats;
629
610 int shared_queue_sz;
630 u32 pool_size[OCELOT_SB_NUM][OCELOT_SB_POOL_NUM];
631 int packet_buffer_size;
632 int num_frame_refs;
611 int num_mact_rows;
612
613 struct net_device *hw_bridge_dev;
614 u16 bridge_mask;
615 u16 bridge_fwd_mask;
616
617 struct ocelot_port **ports;
618

--- 8 unchanged lines hidden (view full) ---

627 /* In tables like ANA:PORT and the ANA:PGID:PGID mask,
628 * the CPU is located after the physical ports (at the
629 * num_phys_ports index).
630 */
631 u8 num_phys_ports;
632
633 int npi;
634
633 int num_mact_rows;
634
635 struct net_device *hw_bridge_dev;
636 u16 bridge_mask;
637 u16 bridge_fwd_mask;
638
639 struct ocelot_port **ports;
640

--- 8 unchanged lines hidden (view full) ---

649 /* In tables like ANA:PORT and the ANA:PGID:PGID mask,
650 * the CPU is located after the physical ports (at the
651 * num_phys_ports index).
652 */
653 u8 num_phys_ports;
654
655 int npi;
656
635 enum ocelot_tag_prefix inj_prefix;
636 enum ocelot_tag_prefix xtr_prefix;
657 enum ocelot_tag_prefix npi_inj_prefix;
658 enum ocelot_tag_prefix npi_xtr_prefix;
637
638 u32 *lags;
639
640 struct list_head multicast;
641 struct list_head pgids;
642
643 struct list_head dummy_rules;
644 struct ocelot_vcap_block block[3];

--- 89 unchanged lines hidden (view full) ---

734void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data);
735void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);
736int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
737int ocelot_get_ts_info(struct ocelot *ocelot, int port,
738 struct ethtool_ts_info *info);
739void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
740void ocelot_adjust_link(struct ocelot *ocelot, int port,
741 struct phy_device *phydev);
659
660 u32 *lags;
661
662 struct list_head multicast;
663 struct list_head pgids;
664
665 struct list_head dummy_rules;
666 struct ocelot_vcap_block block[3];

--- 89 unchanged lines hidden (view full) ---

756void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data);
757void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);
758int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
759int ocelot_get_ts_info(struct ocelot *ocelot, int port,
760 struct ethtool_ts_info *info);
761void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
762void ocelot_adjust_link(struct ocelot *ocelot, int port,
763 struct phy_device *phydev);
742int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled,
743 struct switchdev_trans *trans);
764int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled);
744void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
765void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
766void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot);
745int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
746 struct net_device *bridge);
747int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
748 struct net_device *bridge);
749int ocelot_fdb_dump(struct ocelot *ocelot, int port,
750 dsa_fdb_dump_cb_t *cb, void *data);
751int ocelot_fdb_add(struct ocelot *ocelot, int port,
752 const unsigned char *addr, u16 vid);

--- 20 unchanged lines hidden (view full) ---

773 struct flow_cls_offload *f, bool ingress);
774int ocelot_cls_flower_stats(struct ocelot *ocelot, int port,
775 struct flow_cls_offload *f, bool ingress);
776int ocelot_port_mdb_add(struct ocelot *ocelot, int port,
777 const struct switchdev_obj_port_mdb *mdb);
778int ocelot_port_mdb_del(struct ocelot *ocelot, int port,
779 const struct switchdev_obj_port_mdb *mdb);
780
767int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
768 struct net_device *bridge);
769int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
770 struct net_device *bridge);
771int ocelot_fdb_dump(struct ocelot *ocelot, int port,
772 dsa_fdb_dump_cb_t *cb, void *data);
773int ocelot_fdb_add(struct ocelot *ocelot, int port,
774 const unsigned char *addr, u16 vid);

--- 20 unchanged lines hidden (view full) ---

795 struct flow_cls_offload *f, bool ingress);
796int ocelot_cls_flower_stats(struct ocelot *ocelot, int port,
797 struct flow_cls_offload *f, bool ingress);
798int ocelot_port_mdb_add(struct ocelot *ocelot, int port,
799 const struct switchdev_obj_port_mdb *mdb);
800int ocelot_port_mdb_del(struct ocelot *ocelot, int port,
801 const struct switchdev_obj_port_mdb *mdb);
802
803int ocelot_devlink_sb_register(struct ocelot *ocelot);
804void ocelot_devlink_sb_unregister(struct ocelot *ocelot);
805int ocelot_sb_pool_get(struct ocelot *ocelot, unsigned int sb_index,
806 u16 pool_index,
807 struct devlink_sb_pool_info *pool_info);
808int ocelot_sb_pool_set(struct ocelot *ocelot, unsigned int sb_index,
809 u16 pool_index, u32 size,
810 enum devlink_sb_threshold_type threshold_type,
811 struct netlink_ext_ack *extack);
812int ocelot_sb_port_pool_get(struct ocelot *ocelot, int port,
813 unsigned int sb_index, u16 pool_index,
814 u32 *p_threshold);
815int ocelot_sb_port_pool_set(struct ocelot *ocelot, int port,
816 unsigned int sb_index, u16 pool_index,
817 u32 threshold, struct netlink_ext_ack *extack);
818int ocelot_sb_tc_pool_bind_get(struct ocelot *ocelot, int port,
819 unsigned int sb_index, u16 tc_index,
820 enum devlink_sb_pool_type pool_type,
821 u16 *p_pool_index, u32 *p_threshold);
822int ocelot_sb_tc_pool_bind_set(struct ocelot *ocelot, int port,
823 unsigned int sb_index, u16 tc_index,
824 enum devlink_sb_pool_type pool_type,
825 u16 pool_index, u32 threshold,
826 struct netlink_ext_ack *extack);
827int ocelot_sb_occ_snapshot(struct ocelot *ocelot, unsigned int sb_index);
828int ocelot_sb_occ_max_clear(struct ocelot *ocelot, unsigned int sb_index);
829int ocelot_sb_occ_port_pool_get(struct ocelot *ocelot, int port,
830 unsigned int sb_index, u16 pool_index,
831 u32 *p_cur, u32 *p_max);
832int ocelot_sb_occ_tc_port_bind_get(struct ocelot *ocelot, int port,
833 unsigned int sb_index, u16 tc_index,
834 enum devlink_sb_pool_type pool_type,
835 u32 *p_cur, u32 *p_max);
836
781#endif
837#endif