* Populate VLAN Filter configuration. * * @param dev * Pointer to Ethernet device structure. * @param on * Toggle filter. * * @return * 0 on success, negative error value otherwise. */
| 746 | * 0 on success, negative error value otherwise. |
| 747 | */ |
| 748 | static int mrvl_populate_vlan_table(struct rte_eth_dev *dev, int on) |
| 749 | { |
| 750 | uint32_t j; |
| 751 | int ret; |
| 752 | struct rte_vlan_filter_conf *vfc; |
| 753 | |
| 754 | vfc = &dev->data->vlan_filter_conf; |
| 755 | for (j = 0; j < RTE_DIM(vfc->ids); j++) { |
| 756 | uint64_t vlan; |
| 757 | uint64_t vbit; |
| 758 | uint64_t ids = vfc->ids[j]; |
| 759 | |
| 760 | if (ids == 0) |
| 761 | continue; |
| 762 | |
| 763 | while (ids) { |
| 764 | vlan = 64 * j; |
| 765 | /* count trailing zeroes */ |
| 766 | vbit = ~ids & (ids - 1); |
| 767 | /* clear least significant bit set */ |
| 768 | ids ^= (ids ^ (ids - 1)) ^ vbit; |
| 769 | for (; vbit; vlan++) |
| 770 | vbit >>= 1; |
| 771 | ret = mrvl_vlan_filter_set(dev, vlan, on); |
| 772 | if (ret) { |
| 773 | MRVL_LOG(ERR, "Failed to setup VLAN filter\n"); |
| 774 | return ret; |
| 775 | } |
| 776 | } |
| 777 | } |
| 778 | |
| 779 | return 0; |
| 780 | } |
| 781 | |
| 782 | /** |
| 783 | * DPDK callback to start the device. |
no test coverage detected