Lines Matching +full:data +full:- +full:mirror
1 // SPDX-License-Identifier: GPL-2.0+
15 #define SPX5_QFWD_MP_OFFSET 9 /* Mirror port offset in the QFWD register */
17 /* Convert from bool ingress/egress to mirror direction */
23 /* Get ports belonging to this mirror */
36 /* Add port to mirror (only front ports) */
50 /* Delete port from mirror (only front ports) */
64 /* Check if mirror contains port */
70 /* Check if mirror is empty */
76 /* Get direction of mirror */
84 /* Set direction of mirror */
92 /* Set the monitor port for this mirror */
101 /* Get the monitor port of this mirror */
110 /* Check if port is the monitor port of this mirror */
117 /* Get a suitable mirror for this port */
121 struct sparx5 *sparx5 = sport->sparx5; in sparx5_mirror_get()
126 if (sparx5_mirror_has_monitor(sparx5, i, sport->portno)) in sparx5_mirror_get()
127 return -EINVAL; in sparx5_mirror_get()
129 /* Check if existing mirror can be reused in sparx5_mirror_get()
134 sparx5_mirror_has_monitor(sparx5, i, mport->portno)) { in sparx5_mirror_get()
140 /* Return free mirror */ in sparx5_mirror_get()
148 return -ENOENT; in sparx5_mirror_get()
153 u32 mirror_idx, dir = sparx5_mirror_to_dir(entry->ingress); in sparx5_mirror_add()
159 sport = entry->port; in sparx5_mirror_add()
161 mport = entry->mirror.port; in sparx5_mirror_add()
162 sparx5 = sport->sparx5; in sparx5_mirror_add()
164 if (sport->portno == mport->portno) in sparx5_mirror_add()
165 return -EINVAL; in sparx5_mirror_add()
171 if (sparx5_mirror_contains(sparx5, mirror_idx, sport->portno)) in sparx5_mirror_add()
172 return -EEXIST; in sparx5_mirror_add()
174 /* Add port to mirror */ in sparx5_mirror_add()
175 sparx5_mirror_port_add(sparx5, mirror_idx, sport->portno); in sparx5_mirror_add()
177 /* Set direction of mirror */ in sparx5_mirror_add()
180 /* Set monitor port for mirror */ in sparx5_mirror_add()
181 sparx5_mirror_monitor_set(sparx5, mirror_idx, mport->portno); in sparx5_mirror_add()
183 entry->mirror.idx = mirror_idx; in sparx5_mirror_add()
190 struct sparx5_port *port = entry->port; in sparx5_mirror_del()
191 struct sparx5 *sparx5 = port->sparx5; in sparx5_mirror_del()
192 u32 mirror_idx = entry->mirror.idx; in sparx5_mirror_del()
194 sparx5_mirror_port_del(sparx5, mirror_idx, port->portno); in sparx5_mirror_del()
202 sparx5->data->consts->n_ports); in sparx5_mirror_del()
208 struct sparx5_port *port = entry->port; in sparx5_mirror_stats()
212 old_stats = &entry->port->mirror_stats; in sparx5_mirror_stats()
213 sparx5_get_stats64(port->ndev, &new_stats); in sparx5_mirror_stats()
215 if (entry->ingress) { in sparx5_mirror_stats()
217 new_stats.rx_bytes - old_stats->bytes, in sparx5_mirror_stats()
218 new_stats.rx_packets - old_stats->pkts, in sparx5_mirror_stats()
219 new_stats.rx_dropped - old_stats->drops, in sparx5_mirror_stats()
220 old_stats->lastused, in sparx5_mirror_stats()
223 old_stats->bytes = new_stats.rx_bytes; in sparx5_mirror_stats()
224 old_stats->pkts = new_stats.rx_packets; in sparx5_mirror_stats()
225 old_stats->drops = new_stats.rx_dropped; in sparx5_mirror_stats()
226 old_stats->lastused = jiffies; in sparx5_mirror_stats()
229 new_stats.tx_bytes - old_stats->bytes, in sparx5_mirror_stats()
230 new_stats.tx_packets - old_stats->pkts, in sparx5_mirror_stats()
231 new_stats.tx_dropped - old_stats->drops, in sparx5_mirror_stats()
232 old_stats->lastused, in sparx5_mirror_stats()
235 old_stats->bytes = new_stats.tx_bytes; in sparx5_mirror_stats()
236 old_stats->pkts = new_stats.tx_packets; in sparx5_mirror_stats()
237 old_stats->drops = new_stats.tx_dropped; in sparx5_mirror_stats()
238 old_stats->lastused = jiffies; in sparx5_mirror_stats()