ocelot.h (98817a84ff1c755c347ac633ff017a623a631fad) ocelot.h (91c724cfc0cbc049f18c04634ad56080650e93b8)
1/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
2/*
3 * Microsemi Ocelot Switch driver
4 *
5 * Copyright (c) 2017 Microsemi Corporation
6 */
7
8#ifndef _MSCC_OCELOT_H_

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

20#include <soc/mscc/ocelot_qsys.h>
21#include <soc/mscc/ocelot_sys.h>
22#include <soc/mscc/ocelot_dev.h>
23#include <soc/mscc/ocelot_ana.h>
24#include <soc/mscc/ocelot_ptp.h>
25#include <soc/mscc/ocelot.h>
26#include "ocelot_rew.h"
27#include "ocelot_qs.h"
1/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
2/*
3 * Microsemi Ocelot Switch driver
4 *
5 * Copyright (c) 2017 Microsemi Corporation
6 */
7
8#ifndef _MSCC_OCELOT_H_

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

20#include <soc/mscc/ocelot_qsys.h>
21#include <soc/mscc/ocelot_sys.h>
22#include <soc/mscc/ocelot_dev.h>
23#include <soc/mscc/ocelot_ana.h>
24#include <soc/mscc/ocelot_ptp.h>
25#include <soc/mscc/ocelot.h>
26#include "ocelot_rew.h"
27#include "ocelot_qs.h"
28#include "ocelot_tc.h"
29
30#define OCELOT_BUFFER_CELL_SZ 60
31
32#define OCELOT_STATS_CHECK_DELAY (2 * HZ)
33
34#define OCELOT_PTP_QUEUE_SZ 128
35
36struct frame_info {

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

42 u32 timestamp; /* rew_val */
43};
44
45struct ocelot_multicast {
46 struct list_head list;
47 unsigned char addr[ETH_ALEN];
48 u16 vid;
49 u16 ports;
28
29#define OCELOT_BUFFER_CELL_SZ 60
30
31#define OCELOT_STATS_CHECK_DELAY (2 * HZ)
32
33#define OCELOT_PTP_QUEUE_SZ 128
34
35struct frame_info {

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

41 u32 timestamp; /* rew_val */
42};
43
44struct ocelot_multicast {
45 struct list_head list;
46 unsigned char addr[ETH_ALEN];
47 u16 vid;
48 u16 ports;
49 int pgid;
50};
51
50};
51
52struct ocelot_port_tc {
53 bool block_shared;
54 unsigned long offload_cnt;
55
56 unsigned long police_id;
57};
58
52struct ocelot_port_private {
53 struct ocelot_port port;
54 struct net_device *dev;
55 struct phy_device *phy;
56 u8 chip_port;
57
58 struct phy *serdes;
59
60 struct ocelot_port_tc tc;
61};
62
59struct ocelot_port_private {
60 struct ocelot_port port;
61 struct net_device *dev;
62 struct phy_device *phy;
63 u8 chip_port;
64
65 struct phy *serdes;
66
67 struct ocelot_port_tc tc;
68};
69
70struct ocelot_dump_ctx {
71 struct net_device *dev;
72 struct sk_buff *skb;
73 struct netlink_callback *cb;
74 int idx;
75};
76
77/* MAC table entry types.
78 * ENTRYTYPE_NORMAL is subject to aging.
79 * ENTRYTYPE_LOCKED is not subject to aging.
80 * ENTRYTYPE_MACv4 is not subject to aging. For IPv4 multicast.
81 * ENTRYTYPE_MACv6 is not subject to aging. For IPv6 multicast.
82 */
83enum macaccess_entry_type {
84 ENTRYTYPE_NORMAL = 0,
85 ENTRYTYPE_LOCKED,
86 ENTRYTYPE_MACv4,
87 ENTRYTYPE_MACv6,
88};
89
90int ocelot_port_fdb_do_dump(const unsigned char *addr, u16 vid,
91 bool is_static, void *data);
92int ocelot_mact_learn(struct ocelot *ocelot, int port,
93 const unsigned char mac[ETH_ALEN],
94 unsigned int vid, enum macaccess_entry_type type);
95int ocelot_mact_forget(struct ocelot *ocelot,
96 const unsigned char mac[ETH_ALEN], unsigned int vid);
97int ocelot_port_lag_join(struct ocelot *ocelot, int port,
98 struct net_device *bond);
99void ocelot_port_lag_leave(struct ocelot *ocelot, int port,
100 struct net_device *bond);
101
63u32 ocelot_port_readl(struct ocelot_port *port, u32 reg);
64void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg);
65
66#define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val))
67#define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val))
68
102u32 ocelot_port_readl(struct ocelot_port *port, u32 reg);
103void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg);
104
105#define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val))
106#define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val))
107
69int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops);
70int ocelot_probe_port(struct ocelot *ocelot, u8 port,
71 void __iomem *regs,
108int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target,
72 struct phy_device *phy);
73
74void ocelot_set_cpu_port(struct ocelot *ocelot, int cpu,
75 enum ocelot_tag_prefix injection,
76 enum ocelot_tag_prefix extraction);
77
78extern struct notifier_block ocelot_netdevice_nb;
79extern struct notifier_block ocelot_switchdev_nb;
80extern struct notifier_block ocelot_switchdev_blocking_nb;
81
82#define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val))
83#define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val))
84
85#endif
109 struct phy_device *phy);
110
111void ocelot_set_cpu_port(struct ocelot *ocelot, int cpu,
112 enum ocelot_tag_prefix injection,
113 enum ocelot_tag_prefix extraction);
114
115extern struct notifier_block ocelot_netdevice_nb;
116extern struct notifier_block ocelot_switchdev_nb;
117extern struct notifier_block ocelot_switchdev_blocking_nb;
118
119#define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val))
120#define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val))
121
122#endif