Lines Matching refs:sparx5
25 static u64 sparx5_mirror_port_get(struct sparx5 *sparx5, u32 idx) in sparx5_mirror_port_get() argument
27 return (u64)spx5_rd(sparx5, ANA_AC_PROBE_PORT_CFG1(idx)) << 32 | in sparx5_mirror_port_get()
28 spx5_rd(sparx5, ANA_AC_PROBE_PORT_CFG(idx)); in sparx5_mirror_port_get()
32 static void sparx5_mirror_port_add(struct sparx5 *sparx5, u32 idx, u32 portno) in sparx5_mirror_port_add() argument
40 return spx5_rmw(val, val, sparx5, ANA_AC_PROBE_PORT_CFG(idx)); in sparx5_mirror_port_add()
42 return spx5_rmw(val, val, sparx5, ANA_AC_PROBE_PORT_CFG1(idx)); in sparx5_mirror_port_add()
46 static void sparx5_mirror_port_del(struct sparx5 *sparx5, u32 idx, u32 portno) in sparx5_mirror_port_del() argument
54 return spx5_rmw(0, val, sparx5, ANA_AC_PROBE_PORT_CFG(idx)); in sparx5_mirror_port_del()
56 return spx5_rmw(0, val, sparx5, ANA_AC_PROBE_PORT_CFG1(idx)); in sparx5_mirror_port_del()
60 static bool sparx5_mirror_contains(struct sparx5 *sparx5, u32 idx, u32 portno) in sparx5_mirror_contains() argument
62 return (sparx5_mirror_port_get(sparx5, idx) & BIT_ULL(portno)) != 0; in sparx5_mirror_contains()
66 static bool sparx5_mirror_is_empty(struct sparx5 *sparx5, u32 idx) in sparx5_mirror_is_empty() argument
68 return sparx5_mirror_port_get(sparx5, idx) == 0; in sparx5_mirror_is_empty()
72 static u32 sparx5_mirror_dir_get(struct sparx5 *sparx5, u32 idx) in sparx5_mirror_dir_get() argument
74 u32 val = spx5_rd(sparx5, ANA_AC_PROBE_CFG(idx)); in sparx5_mirror_dir_get()
80 static void sparx5_mirror_dir_set(struct sparx5 *sparx5, u32 idx, u32 dir) in sparx5_mirror_dir_set() argument
83 ANA_AC_PROBE_CFG_PROBE_DIRECTION, sparx5, in sparx5_mirror_dir_set()
88 static void sparx5_mirror_monitor_set(struct sparx5 *sparx5, u32 idx, in sparx5_mirror_monitor_set() argument
92 QFWD_FRAME_COPY_CFG_FRMC_PORT_VAL, sparx5, in sparx5_mirror_monitor_set()
97 static u32 sparx5_mirror_monitor_get(struct sparx5 *sparx5, u32 idx) in sparx5_mirror_monitor_get() argument
99 u32 val = spx5_rd(sparx5, in sparx5_mirror_monitor_get()
106 static bool sparx5_mirror_has_monitor(struct sparx5 *sparx5, u32 idx, in sparx5_mirror_has_monitor() argument
109 return sparx5_mirror_monitor_get(sparx5, idx) == portno; in sparx5_mirror_has_monitor()
116 struct sparx5 *sparx5 = sport->sparx5; in sparx5_mirror_get() local
121 if (sparx5_mirror_has_monitor(sparx5, i, sport->portno)) in sparx5_mirror_get()
128 if (sparx5_mirror_dir_get(sparx5, i) == dir && in sparx5_mirror_get()
129 sparx5_mirror_has_monitor(sparx5, i, mport->portno)) { in sparx5_mirror_get()
137 if (sparx5_mirror_is_empty(sparx5, i)) { in sparx5_mirror_get()
150 struct sparx5 *sparx5; in sparx5_mirror_add() local
157 sparx5 = sport->sparx5; in sparx5_mirror_add()
166 if (sparx5_mirror_contains(sparx5, mirror_idx, sport->portno)) in sparx5_mirror_add()
170 sparx5_mirror_port_add(sparx5, mirror_idx, sport->portno); in sparx5_mirror_add()
173 sparx5_mirror_dir_set(sparx5, mirror_idx, dir); in sparx5_mirror_add()
176 sparx5_mirror_monitor_set(sparx5, mirror_idx, mport->portno); in sparx5_mirror_add()
186 struct sparx5 *sparx5 = port->sparx5; in sparx5_mirror_del() local
189 sparx5_mirror_port_del(sparx5, mirror_idx, port->portno); in sparx5_mirror_del()
190 if (!sparx5_mirror_is_empty(sparx5, mirror_idx)) in sparx5_mirror_del()
193 sparx5_mirror_dir_set(sparx5, mirror_idx, SPX5_MIRROR_DISABLED); in sparx5_mirror_del()
195 sparx5_mirror_monitor_set(sparx5, in sparx5_mirror_del()