| 780 | } |
| 781 | |
| 782 | static int |
| 783 | vxlan_ftable_entry_insert(struct vxlan_softc *sc, |
| 784 | struct vxlan_ftable_entry *fe) |
| 785 | { |
| 786 | struct vxlan_ftable_entry *lfe; |
| 787 | uint32_t hash; |
| 788 | int dir; |
| 789 | |
| 790 | VXLAN_LOCK_WASSERT(sc); |
| 791 | hash = VXLAN_SC_FTABLE_HASH(sc, fe->vxlfe_mac); |
| 792 | |
| 793 | lfe = LIST_FIRST(&sc->vxl_ftable[hash]); |
| 794 | if (lfe == NULL) { |
| 795 | LIST_INSERT_HEAD(&sc->vxl_ftable[hash], fe, vxlfe_hash); |
| 796 | goto out; |
| 797 | } |
| 798 | |
| 799 | do { |
| 800 | dir = vxlan_ftable_addr_cmp(fe->vxlfe_mac, lfe->vxlfe_mac); |
| 801 | if (dir == 0) |
| 802 | return (EEXIST); |
| 803 | if (dir > 0) { |
| 804 | LIST_INSERT_BEFORE(lfe, fe, vxlfe_hash); |
| 805 | goto out; |
| 806 | } else if (LIST_NEXT(lfe, vxlfe_hash) == NULL) { |
| 807 | LIST_INSERT_AFTER(lfe, fe, vxlfe_hash); |
| 808 | goto out; |
| 809 | } else |
| 810 | lfe = LIST_NEXT(lfe, vxlfe_hash); |
| 811 | } while (lfe != NULL); |
| 812 | |
| 813 | out: |
| 814 | sc->vxl_ftable_cnt++; |
| 815 | |
| 816 | return (0); |
| 817 | } |
| 818 | |
| 819 | static struct vxlan_ftable_entry * |
| 820 | vxlan_ftable_entry_lookup(struct vxlan_softc *sc, const uint8_t *mac) |
no test coverage detected