int rw_piot_update_vlan_filter(rw_piot_api_handle_t api_handle, uint16_t vlan_id, int on) { rw_piot_device_t *rw_piot_dev = RWPIOT_GET_DEVICE(api_handle); ASSERT(RWPIOT_VALID_DEVICE(rw_piot_dev)); if (NULL == rw_piot_dev) { RW_PIOT_LOG(RTE_LOG_ERR, "PIOT Could not find device by handle\n"); return -1; } return rte_eth_dev_vlan_filter(rw_piot_dev->rte_port_id, vlan_id, on); }
static int slave_vlan_filter_set(uint8_t bonded_port_id, uint8_t slave_port_id) { struct rte_eth_dev *bonded_eth_dev; struct bond_dev_private *internals; int found; int res = 0; uint64_t slab = 0; uint32_t pos = 0; uint16_t first; bonded_eth_dev = &rte_eth_devices[bonded_port_id]; if (bonded_eth_dev->data->dev_conf.rxmode.hw_vlan_filter == 0) return 0; internals = bonded_eth_dev->data->dev_private; found = rte_bitmap_scan(internals->vlan_filter_bmp, &pos, &slab); first = pos; if (!found) return 0; do { uint32_t i; uint64_t mask; for (i = 0, mask = 1; i < RTE_BITMAP_SLAB_BIT_SIZE; i ++, mask <<= 1) { if (unlikely(slab & mask)) res = rte_eth_dev_vlan_filter(slave_port_id, (uint16_t)pos, 1); } found = rte_bitmap_scan(internals->vlan_filter_bmp, &pos, &slab); } while (found && first != pos && res == 0); return res; }