Lines Matching refs:ipa
148 ipa_table_mem(struct ipa *ipa, bool filter, bool hashed, bool ipv6) in ipa_table_mem() argument
161 return ipa_mem_find(ipa, mem_id); in ipa_table_mem()
164 bool ipa_filtered_valid(struct ipa *ipa, u64 filtered) in ipa_filtered_valid() argument
166 struct device *dev = &ipa->pdev->dev; in ipa_filtered_valid()
176 if (count > ipa->filter_count) { in ipa_filtered_valid()
178 count, ipa->filter_count); in ipa_filtered_valid()
187 static dma_addr_t ipa_table_addr(struct ipa *ipa, bool filter_mask, u16 count) in ipa_table_addr() argument
194 WARN_ON(count > max_t(u32, ipa->filter_count, ipa->route_count)); in ipa_table_addr()
199 return ipa->table_addr + skip * sizeof(*ipa->table_virt); in ipa_table_addr()
205 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); in ipa_table_reset_add() local
212 mem = ipa_table_mem(ipa, filter, hashed, ipv6); in ipa_table_reset_add()
221 addr = ipa_table_addr(ipa, false, count); in ipa_table_reset_add()
231 ipa_filter_reset_table(struct ipa *ipa, bool hashed, bool ipv6, bool modem) in ipa_filter_reset_table() argument
233 u64 ep_mask = ipa->filtered; in ipa_filter_reset_table()
237 trans = ipa_cmd_trans_alloc(ipa, hweight64(ep_mask)); in ipa_filter_reset_table()
239 dev_err(&ipa->pdev->dev, in ipa_filter_reset_table()
252 endpoint = &ipa->endpoint[endpoint_id]; in ipa_filter_reset_table()
268 static int ipa_filter_reset(struct ipa *ipa, bool modem) in ipa_filter_reset() argument
272 ret = ipa_filter_reset_table(ipa, false, false, modem); in ipa_filter_reset()
276 ret = ipa_filter_reset_table(ipa, false, true, modem); in ipa_filter_reset()
277 if (ret || !ipa_table_hash_support(ipa)) in ipa_filter_reset()
280 ret = ipa_filter_reset_table(ipa, true, false, modem); in ipa_filter_reset()
284 return ipa_filter_reset_table(ipa, true, true, modem); in ipa_filter_reset()
291 static int ipa_route_reset(struct ipa *ipa, bool modem) in ipa_route_reset() argument
293 bool hash_support = ipa_table_hash_support(ipa); in ipa_route_reset()
294 u32 modem_route_count = ipa->modem_route_count; in ipa_route_reset()
299 trans = ipa_cmd_trans_alloc(ipa, hash_support ? 4 : 2); in ipa_route_reset()
301 dev_err(&ipa->pdev->dev, in ipa_route_reset()
312 count = ipa->route_count - modem_route_count; in ipa_route_reset()
328 void ipa_table_reset(struct ipa *ipa, bool modem) in ipa_table_reset() argument
330 struct device *dev = &ipa->pdev->dev; in ipa_table_reset()
337 ret = ipa_filter_reset(ipa, modem); in ipa_table_reset()
342 ret = ipa_route_reset(ipa, modem); in ipa_table_reset()
348 int ipa_table_hash_flush(struct ipa *ipa) in ipa_table_hash_flush() argument
354 if (!ipa_table_hash_support(ipa)) in ipa_table_hash_flush()
357 trans = ipa_cmd_trans_alloc(ipa, 1); in ipa_table_hash_flush()
359 dev_err(&ipa->pdev->dev, "no transaction for hash flush\n"); in ipa_table_hash_flush()
363 if (ipa->version < IPA_VERSION_5_0) { in ipa_table_hash_flush()
364 reg = ipa_reg(ipa, FILT_ROUT_HASH_FLUSH); in ipa_table_hash_flush()
371 reg = ipa_reg(ipa, FILT_ROUT_CACHE_FLUSH); in ipa_table_hash_flush()
387 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); in ipa_table_init_add() local
407 mem = ipa_table_mem(ipa, filter, false, ipv6); in ipa_table_init_add()
408 hash_mem = ipa_table_mem(ipa, filter, true, ipv6); in ipa_table_init_add()
418 count = 1 + hweight64(ipa->filtered); in ipa_table_init_add()
430 addr = ipa_table_addr(ipa, filter, count); in ipa_table_init_add()
431 hash_addr = ipa_table_addr(ipa, filter, hash_count); in ipa_table_init_add()
442 ipa->zero_addr, true); in ipa_table_init_add()
450 ipa->zero_addr, true); in ipa_table_init_add()
453 int ipa_table_setup(struct ipa *ipa) in ipa_table_setup() argument
470 trans = ipa_cmd_trans_alloc(ipa, 8); in ipa_table_setup()
472 dev_err(&ipa->pdev->dev, "no transaction for table setup\n"); in ipa_table_setup()
496 struct ipa *ipa = endpoint->ipa; in ipa_filter_tuple_zero() local
501 if (ipa->version < IPA_VERSION_5_0) { in ipa_filter_tuple_zero()
502 reg = ipa_reg(ipa, ENDP_FILTER_ROUTER_HSH_CFG); in ipa_filter_tuple_zero()
505 val = ioread32(endpoint->ipa->reg_virt + offset); in ipa_filter_tuple_zero()
511 reg = ipa_reg(ipa, ENDP_FILTER_CACHE_CFG); in ipa_filter_tuple_zero()
518 iowrite32(val, endpoint->ipa->reg_virt + offset); in ipa_filter_tuple_zero()
522 static void ipa_filter_config(struct ipa *ipa, bool modem) in ipa_filter_config() argument
525 u64 ep_mask = ipa->filtered; in ipa_filter_config()
527 if (!ipa_table_hash_support(ipa)) in ipa_filter_config()
536 endpoint = &ipa->endpoint[endpoint_id]; in ipa_filter_config()
542 static bool ipa_route_id_modem(struct ipa *ipa, u32 route_id) in ipa_route_id_modem() argument
544 return route_id < ipa->modem_route_count; in ipa_route_id_modem()
554 static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id) in ipa_route_tuple_zero() argument
560 if (ipa->version < IPA_VERSION_5_0) { in ipa_route_tuple_zero()
561 reg = ipa_reg(ipa, ENDP_FILTER_ROUTER_HSH_CFG); in ipa_route_tuple_zero()
564 val = ioread32(ipa->reg_virt + offset); in ipa_route_tuple_zero()
570 reg = ipa_reg(ipa, ENDP_ROUTER_CACHE_CFG); in ipa_route_tuple_zero()
577 iowrite32(val, ipa->reg_virt + offset); in ipa_route_tuple_zero()
581 static void ipa_route_config(struct ipa *ipa, bool modem) in ipa_route_config() argument
585 if (!ipa_table_hash_support(ipa)) in ipa_route_config()
588 for (route_id = 0; route_id < ipa->route_count; route_id++) in ipa_route_config()
589 if (ipa_route_id_modem(ipa, route_id) == modem) in ipa_route_config()
590 ipa_route_tuple_zero(ipa, route_id); in ipa_route_config()
594 void ipa_table_config(struct ipa *ipa) in ipa_table_config() argument
596 ipa_filter_config(ipa, false); in ipa_table_config()
597 ipa_filter_config(ipa, true); in ipa_table_config()
598 ipa_route_config(ipa, false); in ipa_table_config()
599 ipa_route_config(ipa, true); in ipa_table_config()
605 bool ipa_table_mem_valid(struct ipa *ipa, bool filter) in ipa_table_mem_valid() argument
607 bool hash_support = ipa_table_hash_support(ipa); in ipa_table_mem_valid()
617 mem_ipv4 = ipa_table_mem(ipa, filter, false, false); in ipa_table_mem_valid()
621 mem_ipv6 = ipa_table_mem(ipa, filter, false, true); in ipa_table_mem_valid()
633 ipa->filter_count = count - 1; /* Filter map in first entry */ in ipa_table_mem_valid()
635 ipa->route_count = count; in ipa_table_mem_valid()
638 if (!ipa_cmd_table_init_valid(ipa, mem_ipv4, !filter)) in ipa_table_mem_valid()
646 if (count < 1 + hweight64(ipa->filtered)) in ipa_table_mem_valid()
652 if (count < ipa->modem_route_count + 1) in ipa_table_mem_valid()
661 mem_hashed = ipa_table_mem(ipa, filter, true, false); in ipa_table_mem_valid()
671 mem_hashed = ipa_table_mem(ipa, filter, true, true); in ipa_table_mem_valid()
714 int ipa_table_init(struct ipa *ipa) in ipa_table_init() argument
716 struct device *dev = &ipa->pdev->dev; in ipa_table_init()
725 count = max_t(u32, ipa->filter_count, ipa->route_count); in ipa_table_init()
738 ipa->table_virt = virt; in ipa_table_init()
739 ipa->table_addr = addr; in ipa_table_init()
750 if (ipa->version < IPA_VERSION_5_0) in ipa_table_init()
751 *virt++ = cpu_to_le64(ipa->filtered << 1); in ipa_table_init()
753 *virt++ = cpu_to_le64(ipa->filtered); in ipa_table_init()
763 void ipa_table_exit(struct ipa *ipa) in ipa_table_exit() argument
765 u32 count = max_t(u32, 1 + ipa->filter_count, ipa->route_count); in ipa_table_exit()
766 struct device *dev = &ipa->pdev->dev; in ipa_table_exit()
771 dma_free_coherent(dev, size, ipa->table_virt, ipa->table_addr); in ipa_table_exit()
772 ipa->table_addr = 0; in ipa_table_exit()
773 ipa->table_virt = NULL; in ipa_table_exit()