Lines Matching refs:mact_entry

243 	struct sparx5_mact_entry *mact_entry;  in alloc_mact_entry()  local
245 mact_entry = devm_kzalloc(sparx5->dev, in alloc_mact_entry()
246 sizeof(*mact_entry), GFP_ATOMIC); in alloc_mact_entry()
247 if (!mact_entry) in alloc_mact_entry()
250 memcpy(mact_entry->mac, mac, ETH_ALEN); in alloc_mact_entry()
251 mact_entry->vid = vid; in alloc_mact_entry()
252 mact_entry->port = port_index; in alloc_mact_entry()
253 return mact_entry; in alloc_mact_entry()
260 struct sparx5_mact_entry *mact_entry; in find_mact_entry() local
264 list_for_each_entry(mact_entry, &sparx5->mact_entries, list) { in find_mact_entry()
265 if (mact_entry->vid == vid && in find_mact_entry()
266 ether_addr_equal(mac, mact_entry->mac) && in find_mact_entry()
267 mact_entry->port == port_index) { in find_mact_entry()
268 res = mact_entry; in find_mact_entry()
294 struct sparx5_mact_entry *mact_entry; in sparx5_add_mact_entry() local
308 mact_entry = find_mact_entry(sparx5, addr, vid, portno); in sparx5_add_mact_entry()
309 if (mact_entry) in sparx5_add_mact_entry()
315 mact_entry = alloc_mact_entry(sparx5, addr, vid, portno); in sparx5_add_mact_entry()
316 if (!mact_entry) in sparx5_add_mact_entry()
320 list_add_tail(&mact_entry->list, &sparx5->mact_entries); in sparx5_add_mact_entry()
327 if (mact_entry->flags == 0) { in sparx5_add_mact_entry()
328 mact_entry->flags |= MAC_ENT_LOCK; /* Don't age this */ in sparx5_add_mact_entry()
340 struct sparx5_mact_entry *mact_entry, *tmp; in sparx5_del_mact_entry() local
346 list_for_each_entry_safe(mact_entry, tmp, &sparx5->mact_entries, in sparx5_del_mact_entry()
348 if ((vid == 0 || mact_entry->vid == vid) && in sparx5_del_mact_entry()
349 ether_addr_equal(addr, mact_entry->mac)) { in sparx5_del_mact_entry()
350 list_del(&mact_entry->list); in sparx5_del_mact_entry()
351 devm_kfree(sparx5->dev, mact_entry); in sparx5_del_mact_entry()
353 sparx5_mact_forget(sparx5, addr, mact_entry->vid); in sparx5_del_mact_entry()
365 struct sparx5_mact_entry *mact_entry; in sparx5_mact_handle_entry() local
381 list_for_each_entry(mact_entry, &sparx5->mact_entries, list) { in sparx5_mact_handle_entry()
382 if (mact_entry->vid == vid && in sparx5_mact_handle_entry()
383 ether_addr_equal(mac, mact_entry->mac)) { in sparx5_mact_handle_entry()
385 mact_entry->flags |= MAC_ENT_ALIVE; in sparx5_mact_handle_entry()
386 if (mact_entry->port != port) { in sparx5_mact_handle_entry()
388 mact_entry->port, port); in sparx5_mact_handle_entry()
389 mact_entry->port = port; in sparx5_mact_handle_entry()
390 mact_entry->flags |= MAC_ENT_MOVED; in sparx5_mact_handle_entry()
398 if (found && !(mact_entry->flags & MAC_ENT_MOVED)) in sparx5_mact_handle_entry()
404 mact_entry = alloc_mact_entry(sparx5, mac, vid, port); in sparx5_mact_handle_entry()
405 if (!mact_entry) in sparx5_mact_handle_entry()
408 mact_entry->flags |= MAC_ENT_ALIVE; in sparx5_mact_handle_entry()
410 list_add_tail(&mact_entry->list, &sparx5->mact_entries); in sparx5_mact_handle_entry()
425 struct sparx5_mact_entry *mact_entry, *tmp; in sparx5_mact_pull_work() local
433 list_for_each_entry(mact_entry, &sparx5->mact_entries, list) in sparx5_mact_pull_work()
434 mact_entry->flags &= MAC_ENT_LOCK; in sparx5_mact_pull_work()
458 list_for_each_entry_safe(mact_entry, tmp, &sparx5->mact_entries, in sparx5_mact_pull_work()
461 if (mact_entry->flags & (MAC_ENT_ALIVE | MAC_ENT_LOCK)) in sparx5_mact_pull_work()
465 mact_entry->mac, mact_entry->vid, in sparx5_mact_pull_work()
466 sparx5->ports[mact_entry->port]->ndev, in sparx5_mact_pull_work()
469 list_del(&mact_entry->list); in sparx5_mact_pull_work()
470 devm_kfree(sparx5->dev, mact_entry); in sparx5_mact_pull_work()