if (cpu_port)
mdb_entry->cpu_copy++; else
mdb_entry->ports |= BIT(port->chip_port);
/* Copy the frame to CPU only if the CPU is in the VLAN */ if (lan966x_vlan_cpu_member_cpu_vlan_mask(lan966x, mdb_entry->vid) &&
mdb_entry->cpu_copy)
cpu_copy = true;
mdb_entry = lan966x_mdb_entry_get(lan966x, mdb->addr, mdb->vid); if (!mdb_entry) return -ENOENT;
ports = mdb_entry->ports; if (cpu_port) { /* If there are still other references to the CPU port then * there is no point to delete and add again the same entry
*/
mdb_entry->cpu_copy--; if (mdb_entry->cpu_copy) return0;
} else {
ports &= ~BIT(port->chip_port);
}
/* Try to find an existing pgid that uses the same ports as the * mdb_entry
*/
list_for_each_entry(pgid_entry, &lan966x->pgid_entries, list) { if (pgid_entry->ports == mdb_entry->ports) {
refcount_inc(&pgid_entry->refcount); return pgid_entry;
}
}
/* Try to find an empty pgid entry and allocate one in case it finds it, * otherwise it means that there are no more resources
*/ for (index = PGID_GP_START; index < PGID_GP_END; index++) { bool used = false;
list_for_each_entry(pgid_entry, &lan966x->pgid_entries, list) { if (pgid_entry->index == index) {
used = true; break;
}
}
if (!used) return lan966x_pgid_entry_add(lan966x, index,
mdb_entry->ports);
}
/* Copy the frame to CPU only if the CPU is in the VLAN */ if (!lan966x_vlan_cpu_member_cpu_vlan_mask(lan966x, mdb_entry->vid) &&
mdb_entry->cpu_copy)
mdb_entry->ports &= BIT(CPU_PORT);
mdb_entry = lan966x_mdb_entry_get(lan966x, mdb->addr, mdb->vid); if (!mdb_entry) return -ENOENT;
ports = mdb_entry->ports; if (cpu_port) { /* If there are still other references to the CPU port then * there is no point to delete and add again the same entry
*/
mdb_entry->cpu_copy--; if (mdb_entry->cpu_copy) return0;
/* Split the way the entries are added for ipv4/ipv6 and for l2. The * reason is that for ipv4/ipv6 it doesn't require to use any pgid * entry, while for l2 is required to use pgid entries
*/
type = lan966x_mdb_classify(mdb->addr); if (type == ENTRYTYPE_MACV4 || type == ENTRYTYPE_MACV6) return lan966x_mdb_ip_add(port, mdb, type);
/* Split the way the entries are removed for ipv4/ipv6 and for l2. The * reason is that for ipv4/ipv6 it doesn't require to use any pgid * entry, while for l2 is required to use pgid entries
*/
type = lan966x_mdb_classify(mdb->addr); if (type == ENTRYTYPE_MACV4 || type == ENTRYTYPE_MACV6) return lan966x_mdb_ip_del(port, mdb, type);
list_for_each_entry(mdb_entry, &lan966x->mdb_entries, list) {
type = lan966x_mdb_classify(mdb_entry->mac);
lan966x_mdb_encode_mac(mac, mdb_entry, type); /* Remove just the MAC entry, still keep the PGID in case of L2 * entries because this can be restored at later point
*/
lan966x_mac_forget(lan966x, mac, mdb_entry->vid, type);
}
}
list_for_each_entry(mdb_entry, &lan966x->mdb_entries, list) {
type = lan966x_mdb_classify(mdb_entry->mac);
lan966x_mdb_encode_mac(mac, mdb_entry, type); if (type == ENTRYTYPE_MACV4 || type == ENTRYTYPE_MACV6) { /* Copy the frame to CPU only if the CPU is in the VLAN */ if (lan966x_vlan_cpu_member_cpu_vlan_mask(lan966x,
mdb_entry->vid) &&
mdb_entry->cpu_copy)
cpu_copy = true;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet am 2026-06-07)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.