Lines Matching full:ipa

17 #include "ipa.h"
28 * DOC: IPA Filter and Route Tables
30 * The IPA has tables defined in its local shared memory that define filter
39 * Hashed operation is not supported by all IPA hardware.
49 * and so on. Space is set aside in IPA local memory to hold as many
56 * IPA filtering functionality.
58 * IPA Filter Table
77 * though the AP currently does not use the IPA routing functionality.
79 * IPA Route Table
99 /* IPA hardware constrains filter and route tables alignment */
121 /* IPA hardware accesses memory 128 bytes at a time. Addresses in ipa_table_validate_build()
153 ipa_table_valid_one(struct ipa *ipa, bool route, bool ipv6, bool hashed) in ipa_table_valid_one() argument
155 struct device *dev = &ipa->pdev->dev; in ipa_table_valid_one()
161 mem = hashed ? &ipa->mem[IPA_MEM_V6_ROUTE_HASHED] in ipa_table_valid_one()
162 : &ipa->mem[IPA_MEM_V6_ROUTE]; in ipa_table_valid_one()
164 mem = hashed ? &ipa->mem[IPA_MEM_V4_ROUTE_HASHED] in ipa_table_valid_one()
165 : &ipa->mem[IPA_MEM_V4_ROUTE]; in ipa_table_valid_one()
169 mem = hashed ? &ipa->mem[IPA_MEM_V6_FILTER_HASHED] in ipa_table_valid_one()
170 : &ipa->mem[IPA_MEM_V6_FILTER]; in ipa_table_valid_one()
172 mem = hashed ? &ipa->mem[IPA_MEM_V4_FILTER_HASHED] in ipa_table_valid_one()
173 : &ipa->mem[IPA_MEM_V4_FILTER]; in ipa_table_valid_one()
177 if (!ipa_cmd_table_valid(ipa, mem, route, ipv6, hashed)) in ipa_table_valid_one()
196 bool ipa_table_valid(struct ipa *ipa) in ipa_table_valid() argument
200 valid = valid && ipa_table_valid_one(ipa, false, false, false); in ipa_table_valid()
201 valid = valid && ipa_table_valid_one(ipa, false, false, true); in ipa_table_valid()
202 valid = valid && ipa_table_valid_one(ipa, false, true, false); in ipa_table_valid()
203 valid = valid && ipa_table_valid_one(ipa, false, true, true); in ipa_table_valid()
204 valid = valid && ipa_table_valid_one(ipa, true, false, false); in ipa_table_valid()
205 valid = valid && ipa_table_valid_one(ipa, true, false, true); in ipa_table_valid()
206 valid = valid && ipa_table_valid_one(ipa, true, true, false); in ipa_table_valid()
207 valid = valid && ipa_table_valid_one(ipa, true, true, true); in ipa_table_valid()
212 bool ipa_filter_map_valid(struct ipa *ipa, u32 filter_map) in ipa_filter_map_valid() argument
214 struct device *dev = &ipa->pdev->dev; in ipa_filter_map_valid()
243 static dma_addr_t ipa_table_addr(struct ipa *ipa, bool filter_mask, u16 count) in ipa_table_addr() argument
255 return ipa->table_addr + skip * sizeof(*ipa->table_virt); in ipa_table_addr()
261 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); in ipa_table_reset_add() local
275 addr = ipa_table_addr(ipa, false, count); in ipa_table_reset_add()
285 ipa_filter_reset_table(struct ipa *ipa, const struct ipa_mem *mem, bool modem) in ipa_filter_reset_table() argument
287 u32 ep_mask = ipa->filter_map; in ipa_filter_reset_table()
295 trans = ipa_cmd_trans_alloc(ipa, count); in ipa_filter_reset_table()
297 dev_err(&ipa->pdev->dev, in ipa_filter_reset_table()
310 endpoint = &ipa->endpoint[endpoint_id]; in ipa_filter_reset_table()
326 static int ipa_filter_reset(struct ipa *ipa, bool modem) in ipa_filter_reset() argument
330 ret = ipa_filter_reset_table(ipa, &ipa->mem[IPA_MEM_V4_FILTER], modem); in ipa_filter_reset()
334 ret = ipa_filter_reset_table(ipa, &ipa->mem[IPA_MEM_V4_FILTER_HASHED], in ipa_filter_reset()
339 ret = ipa_filter_reset_table(ipa, &ipa->mem[IPA_MEM_V6_FILTER], modem); in ipa_filter_reset()
342 ret = ipa_filter_reset_table(ipa, &ipa->mem[IPA_MEM_V6_FILTER_HASHED], in ipa_filter_reset()
352 static int ipa_route_reset(struct ipa *ipa, bool modem) in ipa_route_reset() argument
358 trans = ipa_cmd_trans_alloc(ipa, 4); in ipa_route_reset()
360 dev_err(&ipa->pdev->dev, in ipa_route_reset()
375 &ipa->mem[IPA_MEM_V4_ROUTE]); in ipa_route_reset()
377 &ipa->mem[IPA_MEM_V4_ROUTE_HASHED]); in ipa_route_reset()
380 &ipa->mem[IPA_MEM_V6_ROUTE]); in ipa_route_reset()
382 &ipa->mem[IPA_MEM_V6_ROUTE_HASHED]); in ipa_route_reset()
389 void ipa_table_reset(struct ipa *ipa, bool modem) in ipa_table_reset() argument
391 struct device *dev = &ipa->pdev->dev; in ipa_table_reset()
398 ret = ipa_filter_reset(ipa, modem); in ipa_table_reset()
403 ret = ipa_route_reset(ipa, modem); in ipa_table_reset()
409 int ipa_table_hash_flush(struct ipa *ipa) in ipa_table_hash_flush() argument
411 u32 offset = ipa_reg_filt_rout_hash_flush_offset(ipa->version); in ipa_table_hash_flush()
415 /* IPA version 4.2 does not support hashed tables */ in ipa_table_hash_flush()
416 if (ipa->version == IPA_VERSION_4_2) in ipa_table_hash_flush()
419 trans = ipa_cmd_trans_alloc(ipa, 1); in ipa_table_hash_flush()
421 dev_err(&ipa->pdev->dev, "no transaction for hash flush\n"); in ipa_table_hash_flush()
440 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); in ipa_table_init_add() local
454 count = hweight32(ipa->filter_map); in ipa_table_init_add()
463 addr = ipa_table_addr(ipa, filter, count); in ipa_table_init_add()
464 hash_addr = ipa_table_addr(ipa, filter, hash_count); in ipa_table_init_add()
470 int ipa_table_setup(struct ipa *ipa) in ipa_table_setup() argument
474 trans = ipa_cmd_trans_alloc(ipa, 4); in ipa_table_setup()
476 dev_err(&ipa->pdev->dev, "no transaction for table setup\n"); in ipa_table_setup()
481 &ipa->mem[IPA_MEM_V4_ROUTE], in ipa_table_setup()
482 &ipa->mem[IPA_MEM_V4_ROUTE_HASHED]); in ipa_table_setup()
485 &ipa->mem[IPA_MEM_V6_ROUTE], in ipa_table_setup()
486 &ipa->mem[IPA_MEM_V6_ROUTE_HASHED]); in ipa_table_setup()
489 &ipa->mem[IPA_MEM_V4_FILTER], in ipa_table_setup()
490 &ipa->mem[IPA_MEM_V4_FILTER_HASHED]); in ipa_table_setup()
493 &ipa->mem[IPA_MEM_V6_FILTER], in ipa_table_setup()
494 &ipa->mem[IPA_MEM_V6_FILTER_HASHED]); in ipa_table_setup()
501 void ipa_table_teardown(struct ipa *ipa) in ipa_table_teardown() argument
521 val = ioread32(endpoint->ipa->reg_virt + offset); in ipa_filter_tuple_zero()
526 iowrite32(val, endpoint->ipa->reg_virt + offset); in ipa_filter_tuple_zero()
529 static void ipa_filter_config(struct ipa *ipa, bool modem) in ipa_filter_config() argument
532 u32 ep_mask = ipa->filter_map; in ipa_filter_config()
534 /* IPA version 4.2 has no hashed route tables */ in ipa_filter_config()
535 if (ipa->version == IPA_VERSION_4_2) in ipa_filter_config()
544 endpoint = &ipa->endpoint[endpoint_id]; in ipa_filter_config()
550 static void ipa_filter_deconfig(struct ipa *ipa, bool modem) in ipa_filter_deconfig() argument
563 * @ipa: IPA pointer
568 static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id) in ipa_route_tuple_zero() argument
573 val = ioread32(ipa->reg_virt + offset); in ipa_route_tuple_zero()
578 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 /* IPA version 4.2 has no hashed route tables */ in ipa_route_config()
586 if (ipa->version == IPA_VERSION_4_2) in ipa_route_config()
591 ipa_route_tuple_zero(ipa, route_id); in ipa_route_config()
594 static void ipa_route_deconfig(struct ipa *ipa, bool modem) in ipa_route_deconfig() argument
599 void ipa_table_config(struct ipa *ipa) in ipa_table_config() argument
601 ipa_filter_config(ipa, false); in ipa_table_config()
602 ipa_filter_config(ipa, true); in ipa_table_config()
603 ipa_route_config(ipa, false); in ipa_table_config()
604 ipa_route_config(ipa, true); in ipa_table_config()
607 void ipa_table_deconfig(struct ipa *ipa) in ipa_table_deconfig() argument
609 ipa_route_deconfig(ipa, true); in ipa_table_deconfig()
610 ipa_route_deconfig(ipa, false); in ipa_table_deconfig()
611 ipa_filter_deconfig(ipa, true); in ipa_table_deconfig()
612 ipa_filter_deconfig(ipa, false); in ipa_table_deconfig()
617 * route table data. This is used when initializing or resetting the IPA
633 * Note that the IPA hardware requires a filter or route rule address to be
653 int ipa_table_init(struct ipa *ipa) in ipa_table_init() argument
656 struct device *dev = &ipa->pdev->dev; in ipa_table_init()
669 ipa->table_virt = virt; in ipa_table_init()
670 ipa->table_addr = addr; in ipa_table_init()
680 *virt++ = cpu_to_le64((u64)ipa->filter_map << 1); in ipa_table_init()
690 void ipa_table_exit(struct ipa *ipa) in ipa_table_exit() argument
693 struct device *dev = &ipa->pdev->dev; in ipa_table_exit()
698 dma_free_coherent(dev, size, ipa->table_virt, ipa->table_addr); in ipa_table_exit()
699 ipa->table_addr = 0; in ipa_table_exit()
700 ipa->table_virt = NULL; in ipa_table_exit()