felix.c (d0a31acc34dc2921ad32a67a7534704114e64f82) felix.c (e1846cff2fe614d93a2f89461b5935678fd34bd9)
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright 2019-2021 NXP
3 *
4 * This is an umbrella module for all network switches that are
5 * register-compatible with Ocelot and that perform I/O to their host CPU
6 * through an NPI (Node Processor Interface) Ethernet port.
7 */
8#include <uapi/linux/if_bridge.h>

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

398 * replicated over Ethernet as well, otherwise we'd get no notification of
399 * their arrival when using the ocelot-8021q tagging protocol.
400 */
401static int felix_update_trapping_destinations(struct dsa_switch *ds,
402 bool using_tag_8021q)
403{
404 struct ocelot *ocelot = ds->priv;
405 struct felix *felix = ocelot_to_felix(ocelot);
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright 2019-2021 NXP
3 *
4 * This is an umbrella module for all network switches that are
5 * register-compatible with Ocelot and that perform I/O to their host CPU
6 * through an NPI (Node Processor Interface) Ethernet port.
7 */
8#include <uapi/linux/if_bridge.h>

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

398 * replicated over Ethernet as well, otherwise we'd get no notification of
399 * their arrival when using the ocelot-8021q tagging protocol.
400 */
401static int felix_update_trapping_destinations(struct dsa_switch *ds,
402 bool using_tag_8021q)
403{
404 struct ocelot *ocelot = ds->priv;
405 struct felix *felix = ocelot_to_felix(ocelot);
406 struct ocelot_vcap_block *block_vcap_is2;
406 struct ocelot_vcap_filter *trap;
407 enum ocelot_mask_mode mask_mode;
408 unsigned long port_mask;
409 struct dsa_port *dp;
410 bool cpu_copy_ena;
411 int cpu = -1, err;
412
413 if (!felix->info->quirk_no_xtr_irq)
414 return 0;
415
416 /* Figure out the current CPU port */
417 dsa_switch_for_each_cpu_port(dp, ds) {
418 cpu = dp->index;
419 break;
420 }
421
422 /* We are sure that "cpu" was found, otherwise
423 * dsa_tree_setup_default_cpu() would have failed earlier.
424 */
407 struct ocelot_vcap_filter *trap;
408 enum ocelot_mask_mode mask_mode;
409 unsigned long port_mask;
410 struct dsa_port *dp;
411 bool cpu_copy_ena;
412 int cpu = -1, err;
413
414 if (!felix->info->quirk_no_xtr_irq)
415 return 0;
416
417 /* Figure out the current CPU port */
418 dsa_switch_for_each_cpu_port(dp, ds) {
419 cpu = dp->index;
420 break;
421 }
422
423 /* We are sure that "cpu" was found, otherwise
424 * dsa_tree_setup_default_cpu() would have failed earlier.
425 */
426 block_vcap_is2 = &ocelot->block[VCAP_IS2];
425
426 /* Make sure all traps are set up for that destination */
427
428 /* Make sure all traps are set up for that destination */
427 list_for_each_entry(trap, &ocelot->traps, trap_list) {
429 list_for_each_entry(trap, &block_vcap_is2->rules, list) {
430 if (!trap->is_trap)
431 continue;
432
428 /* Figure out the current trapping destination */
429 if (using_tag_8021q) {
430 /* Redirect to the tag_8021q CPU port. If timestamps
431 * are necessary, also copy trapped packets to the CPU
432 * port module.
433 */
434 mask_mode = OCELOT_MASK_MODE_REDIRECT;
435 port_mask = BIT(cpu);

--- 1538 unchanged lines hidden ---
433 /* Figure out the current trapping destination */
434 if (using_tag_8021q) {
435 /* Redirect to the tag_8021q CPU port. If timestamps
436 * are necessary, also copy trapped packets to the CPU
437 * port module.
438 */
439 mask_mode = OCELOT_MASK_MODE_REDIRECT;
440 port_mask = BIT(cpu);

--- 1538 unchanged lines hidden ---