MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mrvl_populate_vlan_table

Function mrvl_populate_vlan_table

dpdk/drivers/net/mvpp2/mrvl_ethdev.c:748–780  ·  view source on GitHub ↗

* Populate VLAN Filter configuration. * * @param dev * Pointer to Ethernet device structure. * @param on * Toggle filter. * * @return * 0 on success, negative error value otherwise. */

Source from the content-addressed store, hash-verified

746 * 0 on success, negative error value otherwise.
747 */
748static 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.

Callers 2

mrvl_dev_startFunction · 0.85
mrvl_vlan_offload_setFunction · 0.85

Calls 1

mrvl_vlan_filter_setFunction · 0.85

Tested by

no test coverage detected